2012-11-30 19:44:40 +01:00
|
|
|
#include <sys/types.h>
|
2011-04-07 09:43:36 +02:00
|
|
|
#include <minix/sysutil.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
u32_t sys_jiffies(void)
|
|
|
|
{
|
|
|
|
clock_t ticks;
|
|
|
|
|
2013-03-29 22:48:22 +01:00
|
|
|
if (getticks(&ticks) == OK)
|
2011-04-07 09:43:36 +02:00
|
|
|
return ticks;
|
|
|
|
else
|
|
|
|
panic("getuptime() failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
u32_t sys_now(void)
|
|
|
|
{
|
|
|
|
static u32_t hz;
|
|
|
|
u32_t jiffs;
|
|
|
|
|
|
|
|
if (!hz)
|
|
|
|
hz = sys_hz();
|
|
|
|
|
2013-03-29 22:48:22 +01:00
|
|
|
/* use ticks not realtime as sys_now() is used to calculate timers */
|
2011-04-07 09:43:36 +02:00
|
|
|
jiffs = sys_jiffies();
|
|
|
|
|
|
|
|
return jiffs * (1000 / hz);
|
|
|
|
}
|
|
|
|
|