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