timer: Add functions to initialize absolute timer structures.
Otherwise there's no good way to create an absolute timer structure without fiddling with its internal structure or assuming a zero initialized structure has a value of zero. BUG=chrome-os-partner:19420 TEST=Used in a new monotonic implementation on pit. BRANCH=None Change-Id: Iffe3b6b25ed7963fcfb66f749c531ea445ea4aeb Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/65301 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Stefan Reinauer <reinauer@google.com> Reviewed-by: Stefan Reinauer <reinauer@google.com> Tested-by: Stefan Reinauer <reinauer@google.com>
This commit is contained in:
parent
8ec61e52a6
commit
e2e5c1ef3b
1 changed files with 12 additions and 0 deletions
|
|
@ -67,6 +67,18 @@ int timers_run(void);
|
|||
* 0 returned on success, < 0 on error. */
|
||||
int timer_sched_callback(struct timeout_callback *tocb, unsigned long us);
|
||||
|
||||
/* Set an absolute time to a number of microseconds. */
|
||||
static inline void mono_time_set_usecs(struct mono_time *mt, long us)
|
||||
{
|
||||
mt->microseconds = us;
|
||||
}
|
||||
|
||||
/* Set an absolute time to a number of milliseconds. */
|
||||
static inline void mono_time_set_msecs(struct mono_time *mt, long ms)
|
||||
{
|
||||
mt->microseconds = ms * USECS_PER_MSEC;
|
||||
}
|
||||
|
||||
/* Add microseconds to an absoute time. */
|
||||
static inline void mono_time_add_usecs(struct mono_time *mt, long us)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue