xref: /haiku/src/system/libroot/posix/sys/ftime.c (revision f2b4344867e97c3f4e742a1b4a15e6879644601a)
1 /*
2  * Copyright 2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <sys/time.h>
8 #include <sys/timeb.h>
9 
10 
11 int
12 ftime(struct timeb *timeb)
13 {
14 	struct timezone	tz;
15 	struct timeval tv;
16 
17 	if (timeb == NULL)
18 		return -1;
19 
20 	gettimeofday(&tv, &tz);
21 
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;
26 
27 	return 0;
28 }
29 
30