2011-02-17 18:11:09 +01:00
|
|
|
/*
|
|
|
|
gettimeofday.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include "namespace.h"
|
|
|
|
#include <lib.h>
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
#include <string.h>
|
2011-02-17 18:11:09 +01:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
2012-03-30 17:11:01 +02:00
|
|
|
int gettimeofday(struct timeval *__restrict tp, void *__restrict tzp)
|
2011-02-17 18:11:09 +01:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
|
|
|
|
|
|
|
if (_syscall(PM_PROC_NR, PM_GETTIMEOFDAY, &m) < 0)
|
2011-02-17 18:11:09 +01:00
|
|
|
return -1;
|
|
|
|
|
2014-05-12 23:40:11 +02:00
|
|
|
tp->tv_sec = m.m_pm_lc_time.sec;
|
|
|
|
tp->tv_usec = m.m_pm_lc_time.nsec / 1000;
|
2011-02-17 18:11:09 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|