secondary cache feature in vm.
[minix.git] / lib / libc / stdtime / ftime.c
blobcf4c30e70a366d3b813407a1162b651702f708b4
1 /* Ported from glibc */
3 #include <sys/timeb.h>
4 #include <sys/time.h>
6 int ftime(struct timeb *timebuf)
8 struct timeval tv;
9 struct timezone tz;
11 if (gettimeofday (&tv, &tz) < 0)
12 return -1;
14 timebuf->time = tv.tv_sec;
15 timebuf->millitm = (tv.tv_usec + 500) / 1000;
16 if (timebuf->millitm == 1000)
18 ++timebuf->time;
19 timebuf->millitm = 0;
21 timebuf->timezone = tz.tz_minuteswest;
22 timebuf->dstflag = tz.tz_dsttime;
23 return 0;