diff options
Diffstat (limited to 'include/sys/time.h')
-rw-r--r-- | include/sys/time.h | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/include/sys/time.h b/include/sys/time.h index 297e6ff74..2f03203e6 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -14,11 +14,6 @@ extern "C" { #include <linux/time.h> #include <sys/types.h> -extern unsigned long long monotonic_clock(void); -extern void __gethrestime(timestruc_t *); - -#define gethrestime(ts) __gethrestime(ts) - #define TIME32_MAX INT32_MAX #define TIME32_MIN INT32_MIN @@ -27,12 +22,37 @@ extern void __gethrestime(timestruc_t *); #define MICROSEC 1000000 #define NANOSEC 1000000000 +/* Already defined in include/linux/time.h */ +#undef CLOCK_THREAD_CPUTIME_ID +#undef CLOCK_REALTIME +#undef CLOCK_MONOTONIC +#undef CLOCK_PROCESS_CPUTIME_ID + +typedef enum clock_type { + __CLOCK_REALTIME0 = 0, /* obsolete; same as CLOCK_REALTIME */ + CLOCK_VIRTUAL = 1, /* thread's user-level CPU clock */ + CLOCK_THREAD_CPUTIME_ID = 2, /* thread's user+system CPU clock */ + CLOCK_REALTIME = 3, /* wall clock */ + CLOCK_MONOTONIC = 4, /* high resolution monotonic clock */ + CLOCK_PROCESS_CPUTIME_ID = 5, /* process's user+system CPU clock */ + CLOCK_HIGHRES = CLOCK_MONOTONIC, /* alternate name */ + CLOCK_PROF = CLOCK_THREAD_CPUTIME_ID,/* alternate name */ +} clock_type_t; + #define hz \ ({ \ BUG_ON(HZ < 100 || HZ > MICROSEC); \ HZ; \ }) +extern void __gethrestime(timestruc_t *); +extern int __clock_gettime(clock_type_t, timespec_t *); +extern hrtime_t __gethrtime(void); + +#define gethrestime(ts) __gethrestime(ts) +#define clock_gettime(fl, tp) __clock_gettime(fl, tp) +#define gethrtime() __gethrtime() + static __inline__ time_t gethrestime_sec(void) { @@ -42,19 +62,6 @@ gethrestime_sec(void) return now.tv_sec; } -static __inline__ hrtime_t -gethrtime(void) { - /* BUG_ON(cur_timer == timer_none); */ - - /* Solaris expects a long long here but monotonic_clock() returns an - * unsigned long long. Note that monotonic_clock() returns the number - * of nanoseconds passed since kernel initialization. Even for a signed - * long long this will not "go negative" for ~292 years. - */ - return monotonic_clock(); -} - - #ifdef __cplusplus } #endif |