1 #include <sys/cdefs.h> 2 #include <lib.h> 3 #include "namespace.h" 4 5 #include <string.h> 6 #include <sys/time.h> 7 8 #ifdef __weak_alias 9 __weak_alias(clock_gettime, __clock_gettime50); 10 #endif 11 12 int clock_gettime(clockid_t clock_id, struct timespec *res) 13 { 14 message m; 15 16 memset(&m, 0, sizeof(m)); 17 m.m_lc_pm_time.clk_id = clock_id; 18 19 if (_syscall(PM_PROC_NR, PM_CLOCK_GETTIME, &m) < 0) 20 return -1; 21 22 res->tv_sec = m.m_pm_lc_time.sec; 23 res->tv_nsec = m.m_pm_lc_time.nsec; 24 25 return 0; 26 } 27 28