summaryrefslogtreecommitdiff
path: root/minix/lib/libc/sys/gettimeofday.c
blob: a7ecf4844fc9a74b1f7fea2b91bc8b5a59b27b98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
gettimeofday.c
*/

#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>

#include <string.h>
#include <sys/time.h>

int gettimeofday(struct timeval *__restrict tp, void *__restrict tzp)
{
  message m;

  memset(&m, 0, sizeof(m));

  if (_syscall(PM_PROC_NR, PM_GETTIMEOFDAY, &m) < 0)
  	return -1;

  tp->tv_sec = m.m_pm_lc_time.sec;
  tp->tv_usec = m.m_pm_lc_time.nsec / 1000;

  return 0;
}