diff options
author | jsorg71 <jsorg71> | 2007-10-03 22:24:29 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2007-10-03 22:24:29 +0000 |
commit | a432f91bc6585c42d3654c63bc6aedd8f63dadf6 (patch) | |
tree | 88e843bb885bd1a358d2d88e469cac32643247b8 /common | |
parent | 508ec1a3948841527addaaf52cafe519f162ea82 (diff) | |
download | xrdp-proprietary-a432f91bc6585c42d3654c63bc6aedd8f63dadf6.tar.gz xrdp-proprietary-a432f91bc6585c42d3654c63bc6aedd8f63dadf6.zip |
added g_time2 function
Diffstat (limited to 'common')
-rw-r--r-- | common/os_calls.c | 18 | ||||
-rw-r--r-- | common/os_calls.h | 2 |
2 files changed, 20 insertions, 0 deletions
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 <sys/socket.h> #include <sys/un.h> #include <sys/time.h> +#include <sys/times.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> @@ -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 |