Author: bonefish Date: 2011-06-08 15:27:20 +0200 (Wed, 08 Jun 2011) New Revision: 42051 Changeset: https://dev.haiku-os.org/changeset/42051 Modified: haiku/branches/developer/bonefish/signals/src/system/libroot/posix/time/clock.c Log: Use the CLOCKS_PER_SEC macro instead of hard-coding the conversion factor. Modified: haiku/branches/developer/bonefish/signals/src/system/libroot/posix/time/clock.c =================================================================== --- haiku/branches/developer/bonefish/signals/src/system/libroot/posix/time/clock.c 2011-06-08 13:17:00 UTC (rev 42050) +++ haiku/branches/developer/bonefish/signals/src/system/libroot/posix/time/clock.c 2011-06-08 13:27:20 UTC (rev 42051) @@ -8,15 +8,16 @@ #include <OS.h> +#define MICROSECONDS_PER_CLOCK_TICK (1000000 / CLOCKS_PER_SEC) + + 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 + return (clock_t)((info.kernel_time + info.user_time) + / MICROSECONDS_PER_CLOCK_TICK); }