headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / libroot / posix / sys / ftime.c
blob6834ecf4338586bbbf7306d174cc8f0685d45d6d
1 /*
2 * Copyright 2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <sys/time.h>
8 #include <sys/timeb.h>
11 int
12 ftime(struct timeb *timeb)
14 struct timezone tz;
15 struct timeval tv;
17 if (timeb == NULL)
18 return -1;
20 gettimeofday(&tv, &tz);
22 timeb->time = tv.tv_sec;
23 timeb->millitm = tv.tv_usec / 1000UL;
24 timeb->timezone = tz.tz_minuteswest;
25 timeb->dstflag = tz.tz_dsttime;
27 return 0;