From a432f91bc6585c42d3654c63bc6aedd8f63dadf6 Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Wed, 3 Oct 2007 22:24:29 +0000 Subject: [PATCH] added g_time2 function --- common/os_calls.c | 18 ++++++++++++++++++ common/os_calls.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/common/os_calls.c b/common/os_calls.c index dd73bf45..e13ca334 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1478,3 +1479,20 @@ g_time1(void) return time(0); #endif } + +/*****************************************************************************/ +/* returns the number of milliseconds since the machine was + started. */ +int APP_CC +g_time2(void) +{ +#if defined(_WIN32) + return (int)GetTickCount(); +#else + struct tms tm; + clock_t num_ticks; + + num_ticks = times(&tm); + return (int)((num_ticks / CLK_TCK) * 1000); +#endif +} diff --git a/common/os_calls.h b/common/os_calls.h index f2856288..80f8cff1 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -212,5 +212,7 @@ int APP_CC g_check_user_in_group(const char* username, int gid, int* ok); int APP_CC g_time1(void); +int APP_CC +g_time2(void); #endif