added g_time2 function

ulab-original
jsorg71 17 years ago
parent 508ec1a394
commit a432f91bc6

@ -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
}

@ -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

Loading…
Cancel
Save