common: use uint64_t as return type of g_time[23]

This commit is contained in:
Koichiro IWAO 2018-04-16 00:34:42 +09:00
parent 9f0e40e728
commit e97b9352f4
No known key found for this signature in database
GPG Key ID: 9F72CDBC01BF10EB
2 changed files with 7 additions and 7 deletions

View File

@ -3538,24 +3538,24 @@ g_time1(void)
/*****************************************************************************/
/* returns the number of milliseconds since the machine was
started. */
long long
uint64_t
g_time2(void)
{
#if defined(_WIN32)
return (long long)GetTickCount();
return (uint64_t)GetTickCount();
#else
struct tms tm;
clock_t num_ticks = 0;
g_memset(&tm, 0, sizeof(struct tms));
num_ticks = times(&tm);
return (long long)(num_ticks * 10);
return (uint64_t)(num_ticks * 10);
#endif
}
/*****************************************************************************/
/* returns time in milliseconds, uses gettimeofday
does not work in win32 */
long long
uint64_t
g_time3(void)
{
#if defined(_WIN32)
@ -3564,7 +3564,7 @@ g_time3(void)
struct timeval tp;
gettimeofday(&tp, 0);
return ((long long)tp.tv_sec * 1000) + ((long long)tp.tv_usec / 1000);
return ((uint64_t)tp.tv_sec * 1000) + ((uint64_t)tp.tv_usec / 1000);
#endif
}

View File

@ -174,8 +174,8 @@ int g_getuser_info(const char* username, int* gid, int* uid, char** shell,
int g_getgroup_info(const char* groupname, int* gid);
int g_check_user_in_group(const char* username, int gid, int* ok);
int g_time1(void);
long long g_time2(void);
long long g_time3(void);
uint64_t g_time2(void);
uint64_t g_time3(void);
int g_save_to_bmp(const char* filename, char* data, int stride_bytes,
int width, int height, int depth, int bits_per_pixel);
int g_text2bool(const char *s);