1 /* 2 gettimeofday.c 3 */ 4 5 #include <sys/cdefs.h> 6 #include "namespace.h" 7 #include <lib.h> 8 9 #include <string.h> 10 #include <sys/time.h> 11 gettimeofday(struct timeval * __restrict tp,void * __restrict tzp)12int gettimeofday(struct timeval *__restrict tp, void *__restrict tzp) 13 { 14 message m; 15 16 memset(&m, 0, sizeof(m)); 17 18 if (_syscall(PM_PROC_NR, PM_GETTIMEOFDAY, &m) < 0) 19 return -1; 20 21 tp->tv_sec = m.m_pm_lc_time.sec; 22 tp->tv_usec = m.m_pm_lc_time.nsec / 1000; 23 24 return 0; 25 } 26 27