Added and implemented gettimeofday() using real_time_clock_usecs().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5278 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-11-08 01:17:26 +00:00
parent 28d179274c
commit eb04c7678e
2 changed files with 27 additions and 0 deletions
+2
View File
@@ -6,6 +6,7 @@ KernelMergeObject posix_sys.o :
<$(SOURCE_GRIST)>mkdir.c
<$(SOURCE_GRIST)>select.c
<$(SOURCE_GRIST)>sysctl.c
<$(SOURCE_GRIST)>gettimeofday.c
:
-fPIC -DPIC
;
@@ -15,4 +16,5 @@ MergeObjectFromObjects kernel_posix_sys.o :
<$(SOURCE_GRIST)>stat.o
<$(SOURCE_GRIST)>mkdir.o
<$(SOURCE_GRIST)>select.o
<$(SOURCE_GRIST)>gettimeofday.o
;
@@ -0,0 +1,25 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include <sys/time.h>
#include <OS.h>
int
gettimeofday(struct timeval *tv, struct timezone *tz)
{
bigtime_t usecs;
if (tv == NULL)
return 0;
usecs = real_time_clock_usecs();
tv->tv_sec = usecs / 1000000;
tv->tv_usec = usecs % 1000000;
return 0;
}