diff --git a/src/system/libroot/posix/time/Jamfile b/src/system/libroot/posix/time/Jamfile index 4614429b6d..8d93807b8c 100644 --- a/src/system/libroot/posix/time/Jamfile +++ b/src/system/libroot/posix/time/Jamfile @@ -7,6 +7,7 @@ UsePrivateHeaders [ FDirName libroot time ] ; KernelMergeObject posix_time.o : asctime.c + clock.c ctime.c difftime.c localtime.c diff --git a/src/system/libroot/posix/time/clock.c b/src/system/libroot/posix/time/clock.c new file mode 100644 index 0000000000..fc16c9c463 --- /dev/null +++ b/src/system/libroot/posix/time/clock.c @@ -0,0 +1,22 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + + +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 +} +