Add millisecond accessor to Genode::Duration value object
Add a 'trunc_to_plain_ms' method to Gende::Duration to make millisecond-accurate timing safer and more convenient. Ref #2335
This commit is contained in:
parent
d4a75ed9bb
commit
ed89f2f7f0
|
@ -359,6 +359,7 @@ _ZNK6Genode5Child21notify_resource_availEv T
|
||||||
_ZNK6Genode6Thread10stack_baseEv T
|
_ZNK6Genode6Thread10stack_baseEv T
|
||||||
_ZNK6Genode6Thread4nameEv T
|
_ZNK6Genode6Thread4nameEv T
|
||||||
_ZNK6Genode6Thread9stack_topEv T
|
_ZNK6Genode6Thread9stack_topEv T
|
||||||
|
_ZNK6Genode8Duration17trunc_to_plain_msEv T
|
||||||
_ZNK6Genode8Duration17trunc_to_plain_usEv T
|
_ZNK6Genode8Duration17trunc_to_plain_usEv T
|
||||||
_ZNK6Genode8Duration9less_thanERS0_ T
|
_ZNK6Genode8Duration9less_thanERS0_ T
|
||||||
_ZNKSt13bad_exception4whatEv T
|
_ZNKSt13bad_exception4whatEv T
|
||||||
|
|
|
@ -80,6 +80,7 @@ struct Genode::Duration
|
||||||
explicit Duration(Microseconds us) { add(us); }
|
explicit Duration(Microseconds us) { add(us); }
|
||||||
|
|
||||||
Microseconds trunc_to_plain_us() const;
|
Microseconds trunc_to_plain_us() const;
|
||||||
|
Milliseconds trunc_to_plain_ms() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _OS__DURATION_H_ */
|
#endif /* _OS__DURATION_H_ */
|
||||||
|
|
|
@ -82,3 +82,9 @@ Microseconds Duration::trunc_to_plain_us() const
|
||||||
{
|
{
|
||||||
return Microseconds(_microseconds + (_hours ? _hours * US_PER_HOUR : 0));
|
return Microseconds(_microseconds + (_hours ? _hours * US_PER_HOUR : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Milliseconds Duration::trunc_to_plain_ms() const
|
||||||
|
{
|
||||||
|
return Milliseconds(trunc_to_plain_us().value / 1000);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user