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;
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
tp->tv_sec = m.PM_TIME_SEC;
|
|
|
|
tp->tv_usec = m.PM_TIME_USEC;
|
2011-02-17 18:11:09 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|