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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user