aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMax Horn2009-10-08 19:41:38 +0000
committerMax Horn2009-10-08 19:41:38 +0000
commit42120ed626c0d18bc1e1738678dbd1fa96481f04 (patch)
tree90715ea5e5bb3f3f24547f484b2355194b9cd93c /backends/platform
parentf5ccaf7e29183d6e51456d5994eccfd35ff9a117 (diff)
downloadscummvm-rg350-42120ed626c0d18bc1e1738678dbd1fa96481f04.tar.gz
scummvm-rg350-42120ed626c0d18bc1e1738678dbd1fa96481f04.tar.bz2
scummvm-rg350-42120ed626c0d18bc1e1738678dbd1fa96481f04.zip
Introduce a new struct TimeDate, replacing struct tm in client code. May lead to compilation issues in ports, which should be trivial to fix, though
svn-id: r44793
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/PalmOS/Src/be_base.cpp10
-rw-r--r--backends/platform/PalmOS/Src/be_base.h2
-rw-r--r--backends/platform/dc/dc.h2
-rw-r--r--backends/platform/dc/dcmain.cpp10
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp10
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h2
-rw-r--r--backends/platform/gp2x/gp2x-common.h2
-rw-r--r--backends/platform/gp2x/gp2x.cpp10
-rw-r--r--backends/platform/iphone/osys_main.cpp10
-rw-r--r--backends/platform/iphone/osys_main.h2
-rw-r--r--backends/platform/null/null.cpp4
-rw-r--r--backends/platform/ps2/ps2time.cpp4
-rw-r--r--backends/platform/ps2/systemps2.h2
-rw-r--r--backends/platform/psp/osys_psp.cpp10
-rw-r--r--backends/platform/psp/osys_psp.h2
-rw-r--r--backends/platform/sdl/sdl.cpp10
-rw-r--r--backends/platform/sdl/sdl.h2
-rw-r--r--backends/platform/wii/osystem.cpp10
-rw-r--r--backends/platform/wii/osystem.h2
-rw-r--r--backends/platform/wince/wince-sdl.cpp3
-rw-r--r--backends/platform/wince/wince-sdl.h2
21 files changed, 78 insertions, 33 deletions
diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp
index 0355f28501..66dd823df0 100644
--- a/backends/platform/PalmOS/Src/be_base.cpp
+++ b/backends/platform/PalmOS/Src/be_base.cpp
@@ -125,9 +125,15 @@ void OSystem_PalmBase::initBackend() {
OSystem::initBackend();
}
-void OSystem_PalmBase::getTimeAndDate(struct tm &t) const {
+void OSystem_PalmBase::getTimeAndDate(TimeDate &td) const {
time_t curTime = time(0);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
uint32 OSystem_PalmBase::getMillis() {
diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h
index 83b2ec2cbd..3f6da2e058 100644
--- a/backends/platform/PalmOS/Src/be_base.h
+++ b/backends/platform/PalmOS/Src/be_base.h
@@ -239,7 +239,7 @@ public:
bool pollEvent(Common::Event &event);
- void getTimeAndDate(struct tm &t) const;
+ void getTimeAndDate(TimeDate &t) const;
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index f5d200968e..45d9aa99c2 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -123,7 +123,7 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys
void delayMillis(uint msecs);
// Get the current time and date. Correspond to time()+localtime().
- void getTimeAndDate(struct tm &t) const;
+ void getTimeAndDate(TimeDate &t) const;
// Get the next event.
// Returns true if an event was retrieved.
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 795504d243..078c6266a4 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -193,10 +193,16 @@ bool OSystem_Dreamcast::getFeatureState(Feature f)
}
}
-void OSystem_Dreamcast::getTimeAndDate(struct tm &t) const {
+void OSystem_Dreamcast::getTimeAndDate(TimeDate &td) const {
time_t curTime;
time(&curTime);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
void DCHardware::dc_init_hardware()
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 1654bb31e7..8ea9b06b23 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -655,14 +655,20 @@ void OSystem_DS::delayMillis(uint msecs) {
}
-void OSystem_DS::getTimeAndDate(struct tm &t) const {
+void OSystem_DS::getTimeAndDate(TimeDate &td) const {
time_t curTime;
#if 0
curTime = time(0);
#else
curTime = 0xABCD1234 + DS::getMillis() / 1000;
#endif
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
FilesystemFactory *OSystem_DS::getFilesystemFactory() {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index ce55ec2740..27c4052d9d 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -118,7 +118,7 @@ public:
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
- virtual void getTimeAndDate(struct tm &t) const;
+ virtual void getTimeAndDate(TimeDate &t) const;
virtual MutexRef createMutex(void);
virtual void lockMutex(MutexRef mutex);
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
index c8bbd93de0..6878673024 100644
--- a/backends/platform/gp2x/gp2x-common.h
+++ b/backends/platform/gp2x/gp2x-common.h
@@ -138,7 +138,7 @@ public:
// Quit
void quit();
- void getTimeAndDate(struct tm &t) const;
+ void getTimeAndDate(TimeDate &t) const;
virtual Common::TimerManager *getTimerManager();
// Mutex handling
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 21a047b345..e15281dbf4 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -301,9 +301,15 @@ void OSystem_GP2X::delayMillis(uint msecs) {
SDL_Delay(msecs);
}
-void OSystem_GP2X::getTimeAndDate(struct tm &t) const {
+void OSystem_GP2X::getTimeAndDate(TimeDate &td) const {
time_t curTime = time(0);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
Common::TimerManager *OSystem_GP2X::getTimerManager() {
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index eb2ecf8769..b151688e4e 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -198,9 +198,15 @@ void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) {
void OSystem_IPHONE::quit() {
}
-void OSystem_IPHONE::getTimeAndDate(struct tm &t) const {
+void OSystem_IPHONE::getTimeAndDate(TimeDate &td) const {
time_t curTime = time(0);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() {
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index c4c1a8b080..c923d0f4e8 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -169,7 +169,7 @@ public:
FilesystemFactory *getFilesystemFactory() { return _fsFactory; }
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- virtual void getTimeAndDate(struct tm &t) const;
+ virtual void getTimeAndDate(TimeDate &t) const;
virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index ca4eda9158..26e4654dde 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -115,7 +115,7 @@ public:
virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
- virtual void getTimeAndDate(struct tm &t) const;
+ virtual void getTimeAndDate(TimeDate &t) const;
virtual Common::TimerManager *getTimerManager();
FilesystemFactory *getFilesystemFactory();
@@ -321,7 +321,7 @@ Common::TimerManager *OSystem_NULL::getTimerManager() {
return _timer;
}
-void OSystem_NULL::getTimeAndDate(struct tm &t) const {
+void OSystem_NULL::getTimeAndDate(TimeDate &t) const {
}
FilesystemFactory *OSystem_NULL::getFilesystemFactory() {
diff --git a/backends/platform/ps2/ps2time.cpp b/backends/platform/ps2/ps2time.cpp
index 65b4cb90d7..4da8420478 100644
--- a/backends/platform/ps2/ps2time.cpp
+++ b/backends/platform/ps2/ps2time.cpp
@@ -106,7 +106,7 @@ void OSystem_PS2::readRtcTime(void) {
g_day, g_month, g_year + 2000);
}
-void OSystem_PS2::getTimeAndDate(struct tm &t) const {
+void OSystem_PS2::getTimeAndDate(TimeDate &t) const {
uint32 currentSecs = g_timeSecs + (msecCount - g_lastTimeCheck) / 1000;
if (currentSecs >= SECONDS_PER_DAY) {
@@ -121,6 +121,4 @@ void OSystem_PS2::getTimeAndDate(struct tm &t) const {
t.tm_year = g_year + 100;
t.tm_mday = g_day;
t.tm_mon = g_month - 1;
- // tm_wday, tm_yday and tm_isdst are zero for now
- t.tm_wday = t.tm_yday = t.tm_isdst = 0;
}
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 3fa7ce733b..31aa29e83f 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -124,7 +124,7 @@ public:
virtual Common::SaveFileManager *getSavefileManager();
virtual FilesystemFactory *getFilesystemFactory();
- virtual void getTimeAndDate(struct tm &t) const;
+ virtual void getTimeAndDate(TimeDate &t) const;
void timerThread(void);
void soundThread(void);
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 53512beb24..24ea27698c 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -1155,9 +1155,15 @@ void OSystem_PSP::quit() {
sceKernelExitGame();
}
-void OSystem_PSP::getTimeAndDate(struct tm &t) const {
+void OSystem_PSP::getTimeAndDate(TimeDate &td) const {
time_t curTime = time(0);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
#define PSP_CONFIG_FILE "ms0:/scummvm.ini"
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 047fbff97e..7dcae43c1d 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -159,7 +159,7 @@ public:
Audio::Mixer *getMixer() { return _mixer; }
Common::TimerManager *getTimerManager() { return _timer; }
FilesystemFactory *getFilesystemFactory() { return &PSPFilesystemFactory::instance(); }
- void getTimeAndDate(struct tm &t) const;
+ void getTimeAndDate(TimeDate &t) const;
virtual void quit();
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 547720d435..8224bf547c 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -295,9 +295,15 @@ void OSystem_SDL::delayMillis(uint msecs) {
SDL_Delay(msecs);
}
-void OSystem_SDL::getTimeAndDate(struct tm &t) const {
+void OSystem_SDL::getTimeAndDate(TimeDate &td) const {
time_t curTime = time(0);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
Common::TimerManager *OSystem_SDL::getTimerManager() {
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 82c1e7bf1b..4c31414f90 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -183,7 +183,7 @@ public:
// Quit
virtual void quit(); // overloaded by CE backend
- virtual void getTimeAndDate(struct tm &t) const;
+ virtual void getTimeAndDate(TimeDate &t) const;
virtual Common::TimerManager *getTimerManager();
// Mutex handling
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 00547d55d6..12df2ca7e1 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -264,9 +264,15 @@ FilesystemFactory *OSystem_Wii::getFilesystemFactory() {
return &WiiFilesystemFactory::instance();
}
-void OSystem_Wii::getTimeAndDate(struct tm &t) const {
+void OSystem_Wii::getTimeAndDate(TimeDate &td) const {
time_t curTime = time(0);
- t = *localtime(&curTime);
+ struct tm t = *localtime(&curTime);
+ td.tm_sec = t.tm_sec;
+ td.tm_min = t.tm_min;
+ td.tm_hour = t.tm_hour;
+ td.tm_mday = t.tm_mday;
+ td.tm_mon = t.tm_mon;
+ td.tm_year = t.tm_year;
}
void OSystem_Wii::showOptionsDialog() {
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 23097dd027..d277aa38b1 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -211,7 +211,7 @@ public:
virtual Audio::Mixer *getMixer();
virtual Common::TimerManager *getTimerManager();
virtual FilesystemFactory *getFilesystemFactory();
- virtual void getTimeAndDate(struct tm &t) const;
+ virtual void getTimeAndDate(TimeDate &t) const;
};
#endif
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index b2512e0234..c8ddc5c5e3 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -2523,13 +2523,12 @@ void OSystem_WINCE3::quit() {
OSystem_SDL::quit();
}
-void OSystem_WINCE3::getTimeAndDate(struct tm &t) const {
+void OSystem_WINCE3::getTimeAndDate(TimeDate &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;
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index 6900d4fb79..a47df42476 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -85,7 +85,7 @@ public:
void setupMixer();
// Overloaded from OSystem
void engineInit();
- void getTimeAndDate(struct tm &t) const;
+ void getTimeAndDate(TimeDate &t) const;
virtual Common::SeekableReadStream *createConfigReadStream();
virtual Common::WriteStream *createConfigWriteStream();