b.liu | ced8dd0 | 2024-06-28 13:28:29 +0800 | [diff] [blame] | 1 | #include <time.h> |
| 2 | #include <sys/time.h> |
| 3 | |
| 4 | #include "jacana_clock.h" |
| 5 | |
| 6 | /*---------------------------------------------------------------------------*/ |
| 7 | int |
| 8 | jacana_clock_init(void) |
| 9 | { |
| 10 | return 0; |
| 11 | } |
| 12 | /*---------------------------------------------------------------------------*/ |
| 13 | unsigned |
| 14 | jacana_clock_get(void) |
| 15 | { |
| 16 | struct timespec ts; |
| 17 | |
| 18 | clock_gettime(CLOCK_MONOTONIC, &ts); |
| 19 | |
| 20 | return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; |
| 21 | } |
| 22 | /*---------------------------------------------------------------------------*/ |