1 /* 2 * Copyright 2022, Jérôme Duval, jerome.duval@gmail.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <time.h> 8 9 #include <OS.h> 10 #include <SupportDefs.h> 11 12 13 int 14 timespec_get(struct timespec* time, int base) 15 { 16 if (base != TIME_UTC) 17 return 0; 18 bigtime_t microSeconds = real_time_clock_usecs(); 19 20 // set the result 21 time->tv_sec = microSeconds / 1000000; 22 time->tv_nsec = (microSeconds % 1000000) * 1000; 23 return base; 24 } 25 26