| 21 | namespace time |
| 22 | { |
| 23 | s64 now() |
| 24 | { |
| 25 | #if CROWN_PLATFORM_WINDOWS |
| 26 | LARGE_INTEGER ttime; |
| 27 | QueryPerformanceCounter(&ttime); |
| 28 | return (s64)ttime.QuadPart; |
| 29 | #elif CROWN_PLATFORM_OSX |
| 30 | struct timeval now; |
| 31 | gettimeofday(&now, NULL); |
| 32 | return now.tv_sec * s64(1000000) + now.tv_usec; |
| 33 | #else |
| 34 | timespec now; |
| 35 | clock_gettime(CLOCK_MONOTONIC, &now); |
| 36 | return now.tv_sec * s64(1000000000) + now.tv_nsec; |
| 37 | #endif |
| 38 | } |
| 39 | |
| 40 | inline s64 frequency() |
| 41 | { |