summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c18
-rw-r--r--common/os_calls.h2
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