Added missing clock() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14329 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,6 +7,7 @@ UsePrivateHeaders [ FDirName libroot time ] ;
|
|||||||
|
|
||||||
KernelMergeObject posix_time.o :
|
KernelMergeObject posix_time.o :
|
||||||
asctime.c
|
asctime.c
|
||||||
|
clock.c
|
||||||
ctime.c
|
ctime.c
|
||||||
difftime.c
|
difftime.c
|
||||||
localtime.c
|
localtime.c
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
|
|
||||||
|
clock_t
|
||||||
|
clock(void)
|
||||||
|
{
|
||||||
|
thread_info info;
|
||||||
|
get_thread_info(find_thread(NULL), &info);
|
||||||
|
|
||||||
|
return (clock_t)((info.kernel_time + info.user_time) / 1000);
|
||||||
|
// unlike the XSI specs say, CLOCKS_PER_SEC is 1000 and not 1000000 in
|
||||||
|
// BeOS - that means we have to convert the bigtime_t to CLOCKS_PER_SEC
|
||||||
|
// before we return it
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user