diff options
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | libpcsxcore/cdriso.c | 14 |
2 files changed, 14 insertions, 4 deletions
@@ -1,3 +1,7 @@ +September 3, 2009 Wei Mingzhi <weimingzhi@gmail.com> + + * libpcsxcore/cdriso.c: Fixed time overflow on 32-bit GNU/Linux system. + September 1, 2009 Wei Mingzhi <weimingzhi@gmail.com> * libpcsxcore/cdrom.c: Added the definations of some missing commands. diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index d1869734..c7485b6a 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -119,9 +119,16 @@ static void tok2msf(char *time, char *msf) { #ifndef _WIN32 static long GetTickCount(void) { - struct timeval now; + static time_t initial_time = 0; + struct timeval now; + gettimeofday(&now, NULL); - return now.tv_sec * 1000L + now.tv_usec / 1000L; + + if (initial_time == 0) { + initial_time = now.tv_sec; + } + + return (now.tv_sec - initial_time) * 1000L + now.tv_usec / 1000L; } #endif @@ -135,14 +142,13 @@ static void *playthread(void *param) time_t t; long d; - t = 0; + t = GetTickCount(); while (playing) { d = (long)t - GetTickCount(); if (d <= 0) { d = 1; } - #ifdef _WIN32 Sleep(d); #else |
