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:
Axel Dörfler
2005-10-06 17:33:10 +00:00
parent 57ba12dcf6
commit eddf43dd76
2 changed files with 23 additions and 0 deletions
+1
View File
@@ -7,6 +7,7 @@ UsePrivateHeaders [ FDirName libroot time ] ;
KernelMergeObject posix_time.o :
asctime.c
clock.c
ctime.c
difftime.c
localtime.c
+22
View File
@@ -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
}