xref: /haiku/src/system/libroot/posix/sys/gettimeofday.c (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 
6 
7 #include <sys/time.h>
8 #include <OS.h>
9 
10 
11 int
12 gettimeofday(struct timeval *tv, struct timezone *tz)
13 {
14 	bigtime_t usecs;
15 
16 	if (tv == NULL)
17 		return 0;
18 
19 	usecs = real_time_clock_usecs();
20 
21 	tv->tv_sec = usecs / 1000000;
22 	tv->tv_usec = usecs % 1000000;
23 
24 	return 0;
25 }
26