47typedef struct clock_timespec_s {
53get_time(clock_timespec_t *spec)
55#if defined(__linux__) || (defined(__MACH__) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
58 if(clock_gettime(CLOCK_MONOTONIC, &ts) == -1) {
59 err(EXIT_FAILURE,
"clock_gettime");
62 spec->tv_sec = ts.tv_sec;
63 spec->tv_nsec = ts.tv_nsec;
67 if(gettimeofday(&tv, NULL) == -1) {
68 err(EXIT_FAILURE,
"gettimeofday");
71 spec->tv_sec = tv.tv_sec;
72 spec->tv_nsec = tv.tv_usec * 1000;
unsigned long clock_seconds(void)
Get the current value of the platform seconds.
void clock_init(void)
Arch-specific implementation of clock_init for the cc2538.
clock_time_t clock_time(void)
Get the current clock time.
void clock_delay(unsigned int i)
Obsolete delay function but we implement it here since some code still uses it.
#define CLOCK_SECOND
A second, measured in system clock time.