]>
Commit | Line | Data |
---|---|---|
ee476682 | 1 | #include <sys/sysmacros.h> |
2 | #include <sys/time.h> | |
3 | #include "config.h" | |
4 | ||
937879f1 | 5 | #ifdef DEBUG_SUBSYSTEM |
6 | #undef DEBUG_SUBSYSTEM | |
7 | #endif | |
8 | ||
9 | #define DEBUG_SUBSYSTEM S_TIME | |
10 | ||
ee476682 | 11 | void |
12 | __gethrestime(timestruc_t *ts) | |
13 | { | |
14 | getnstimeofday((struct timespec *)ts); | |
15 | } | |
ee476682 | 16 | EXPORT_SYMBOL(__gethrestime); |
79b31f36 | 17 | |
18 | int | |
19 | __clock_gettime(clock_type_t type, timespec_t *tp) | |
20 | { | |
21 | /* Only support CLOCK_REALTIME+__CLOCK_REALTIME0 for now */ | |
937879f1 | 22 | ASSERT((type == CLOCK_REALTIME) || (type == __CLOCK_REALTIME0)); |
79b31f36 | 23 | |
24 | getnstimeofday(tp); | |
25 | return 0; | |
26 | } | |
27 | EXPORT_SYMBOL(__clock_gettime); | |
28 | ||
29 | /* This function may not be as fast as using monotonic_clock() but it | |
30 | * should be much more portable, if performance becomes as issue we can | |
31 | * look at using monotonic_clock() for x86_64 and x86 arches. | |
32 | */ | |
33 | hrtime_t | |
34 | __gethrtime(void) { | |
35 | timespec_t tv; | |
36 | hrtime_t rc; | |
37 | ||
38 | do_posix_clock_monotonic_gettime(&tv); | |
39 | rc = (NSEC_PER_SEC * (hrtime_t)tv.tv_sec) + (hrtime_t)tv.tv_nsec; | |
40 | ||
41 | return rc; | |
42 | } | |
43 | EXPORT_SYMBOL(__gethrtime); |