sys_clock: add some more useful time conversion macros
Change-Id: I0ae05d1b9f871b7b832581552442409233cdec5e Original-work-by: Benjamin Walsh <benjamin.walsh@windriver.com> Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
30d1387c5c
commit
136c18e683
1 changed files with 7 additions and 0 deletions
|
@ -74,6 +74,13 @@ extern int sys_clock_hw_cycles_per_tick;
|
|||
/* number of milliseconds per second */
|
||||
#define MSEC_PER_SEC 1000
|
||||
|
||||
/* number of microseconds per second */
|
||||
#define USEC_PER_SEC ((USEC_PER_MSEC) * (MSEC_PER_SEC))
|
||||
|
||||
/* number of nanoseconds per second */
|
||||
#define NSEC_PER_SEC ((NSEC_PER_USEC) * (USEC_PER_MSEC) * (MSEC_PER_SEC))
|
||||
|
||||
|
||||
/* SYS_CLOCK_HW_CYCLES_TO_NS64 converts CPU clock cycles to nanoseconds */
|
||||
#define SYS_CLOCK_HW_CYCLES_TO_NS64(X) \
|
||||
(((uint64_t)(X) * sys_clock_us_per_tick * NSEC_PER_USEC) / \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue