1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-03-06 02:07:51 +00:00
devlib/src/get_clock_monotonic/get_clock_monotonic.c

19 lines
322 B
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int ret;
struct timespec tp;
ret = clock_gettime(CLOCK_MONOTONIC, &tp);
if (ret) {
perror("clock_gettime()");
return EXIT_FAILURE;
}
printf("%ld.%ld\n", tp.tv_sec, tp.tv_nsec);
return EXIT_SUCCESS;
}