diff options
Diffstat (limited to 'pfinet/mapped-time.h')
-rw-r--r-- | pfinet/mapped-time.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pfinet/mapped-time.h b/pfinet/mapped-time.h new file mode 100644 index 00000000..bcbfc6d4 --- /dev/null +++ b/pfinet/mapped-time.h @@ -0,0 +1,30 @@ +#ifndef _MAPPED_TIME_H_ +#define _MAPPED_TIME_H_ + +#include <maptime.h> + +#define HZ 100 + +extern volatile struct mapped_time_value *mapped_time; +extern long long root_jiffies; + +extern inline int +read_mapped_secs () +{ + return mapped_time->seconds; +} + +extern inline int +fetch_jiffies () +{ + struct timeval tv; + long long j; + + maptime_read (mapped_time, &tv); + + j = (long long) tv.tv_sec * HZ + ((long long) tv.tv_usec * HZ) / 1000000; + return j - root_jiffies; +} + + +#endif |