Rev 4358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4358 | Rev 5063 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | */ |
33 | */ |
Line 34... | Line 34... | ||
34 | 34 | ||
Line 35... | Line -... | ||
35 | - | ||
36 | #include "pipe/p_config.h" |
35 | |
37 | 36 | #include "pipe/p_config.h" |
|
38 | #if defined(PIPE_OS_UNIX) |
- | |
39 | # include |
- | |
40 | # include |
- | |
41 | #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) |
- | |
42 | # include |
- | |
Line 43... | Line 37... | ||
43 | #else |
37 | |
Line 44... | Line 38... | ||
44 | # error Unsupported OS |
38 | # include |
45 | #endif |
39 | # include |
46 | 40 | ||
47 | #include "os_time.h" |
- | |
48 | - | ||
49 | - | ||
50 | int64_t |
- | |
51 | os_time_get_nano(void) |
- | |
52 | { |
- | |
53 | #if defined(PIPE_OS_LINUX) |
- | |
54 | - | ||
55 | struct timespec tv; |
41 | #include "os_time.h" |
56 | clock_gettime(CLOCK_MONOTONIC, &tv); |
42 | |
57 | return tv.tv_nsec + tv.tv_sec*INT64_C(1000000000); |
- | |
58 | - | ||
59 | #elif defined(PIPE_OS_UNIX) |
- | |
60 | - | ||
61 | struct timeval tv; |
- | |
62 | gettimeofday(&tv, NULL); |
- | |
63 | return tv.tv_usec*INT64_C(1000) + tv.tv_sec*INT64_C(1000000000); |
- | |
64 | - | ||
65 | #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) |
- | |
66 | - | ||
67 | static LARGE_INTEGER frequency; |
- | |
68 | LARGE_INTEGER counter; |
- | |
69 | if(!frequency.QuadPart) |
- | |
70 | QueryPerformanceFrequency(&frequency); |
- | |
71 | QueryPerformanceCounter(&counter); |
- | |
72 | return counter.QuadPart*INT64_C(1000000000)/frequency.QuadPart; |
- | |
73 | 43 | ||
Line 74... | Line 44... | ||
74 | #else |
44 | int64_t |