diff options
author | Kostas Nakos | 2007-12-30 17:15:11 +0000 |
---|---|---|
committer | Kostas Nakos | 2007-12-30 17:15:11 +0000 |
commit | 22cfa5660645f3310ec9d8902dd1b9e432302cdf (patch) | |
tree | 40b22c57e1cbdc58002d14fc03cf22f0f1540c95 | |
parent | b9a5e9ea0eae3cf61525361ebbdfac279a8f9361 (diff) | |
download | scummvm-rg350-22cfa5660645f3310ec9d8902dd1b9e432302cdf.tar.gz scummvm-rg350-22cfa5660645f3310ec9d8902dd1b9e432302cdf.tar.bz2 scummvm-rg350-22cfa5660645f3310ec9d8902dd1b9e432302cdf.zip |
implement new gettimeanddate method - fixes bug 1834822 WINCE: Save games have incorrect time & date
svn-id: r30083
-rw-r--r-- | backends/platform/wince/missing/missing.cpp | 43 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 13 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.h | 1 |
3 files changed, 14 insertions, 43 deletions
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index 76faf7ea8c..1eb10c5355 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -89,42 +89,6 @@ int stat(const char *fname, struct stat *ss) return 0; } -/* Limited implementation of time.h. time_t formula is possibly incorrect. */ -EXT_C time_t time(time_t* res) -{ - time_t t; - SYSTEMTIME st; - GetLocalTime(&st); - - t = (time_t)(((((((st.wYear-1970)*12+st.wMonth)*31+st.wDay)*7+st.wDayOfWeek)*24+st.wHour)*60+st.wMinute)*60+st.wSecond); - - if (res) - *res = t; - return t; -} - -EXT_C struct tm* localtime(time_t* timer) -{ - static struct tm tmLocalTime; - unsigned long rem = *timer; - - tmLocalTime.tm_sec = (short)(rem % 60); - rem /= 60; - tmLocalTime.tm_min = (short)(rem % 60); - rem /= 60; - tmLocalTime.tm_hour = (short)(rem % 24); - rem /= 24; - tmLocalTime.tm_mday = (short)(rem % 7); - rem /= 7; - tmLocalTime.tm_mday = (short)(rem % 31); - rem /= 31; - tmLocalTime.tm_mon = (short)(rem % 12); - rem /= 12; - tmLocalTime.tm_year = (short)(rem+1970); - - return &tmLocalTime; -} - char cwd[MAX_PATH+1] = ""; EXT_C char *getcwd(char *buffer, int maxlen) { @@ -408,13 +372,6 @@ char *strdup(const char *strSource) } /* Very limited implementation of sys/time.h */ -void gettimeofday(struct timeval* tp, void* dummy) -{ - DWORD dt = GetTickCount(); - tp->tv_sec = dt/1000; - tp->tv_usec = dt*1000; -} - void usleep(long usec) { long msec = usec/1000; diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 255053c223..f699cabef6 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -2430,6 +2430,19 @@ void OSystem_WINCE3::quit() { OSystem_SDL::quit(); } +void OSystem_WINCE3::getTimeAndDate(struct tm &t) const { + SYSTEMTIME systime; + + GetLocalTime(&systime); + t.tm_year = systime.wYear - 1900; + t.tm_mon = systime.wMonth - 1; + t.tm_wday = systime.wDayOfWeek; + t.tm_mday = systime.wDay; + t.tm_hour = systime.wHour; + t.tm_min = systime.wMinute; + t.tm_sec = systime.wSecond; +} + int OSystem_WINCE3::_platformScreenWidth; int OSystem_WINCE3::_platformScreenHeight; bool OSystem_WINCE3::_isOzone; diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 18c3db5466..21fe46b281 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -86,6 +86,7 @@ public: bool setSoundCallback(SoundProc proc, void *param); // Overloaded from OSystem //void engineInit(); + void getTimeAndDate(struct tm &t) const; // Overloaded from SDL_Common (FIXME) void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); // overloaded by CE backend |