aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/inter.cpp18
-rw-r--r--engines/scumm/saveload.cpp23
-rw-r--r--engines/scumm/script_v6.cpp21
3 files changed, 29 insertions, 33 deletions
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index 3c0127fdbd..2e8e0fead2 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -125,18 +125,16 @@ bool Inter::evalBoolResult() {
}
void Inter::renewTimeInVars() {
- struct tm *t;
- time_t now = time(NULL);
+ struct tm t;
+ _vm->_system->getTimeAndDate(t);
- t = localtime(&now);
-
- WRITE_VAR(5, 1900 + t->tm_year);
- WRITE_VAR(6, t->tm_mon + 1);
+ WRITE_VAR(5, 1900 + t.tm_year);
+ WRITE_VAR(6, t.tm_mon + 1);
WRITE_VAR(7, 0);
- WRITE_VAR(8, t->tm_mday);
- WRITE_VAR(9, t->tm_hour);
- WRITE_VAR(10, t->tm_min);
- WRITE_VAR(11, t->tm_sec);
+ WRITE_VAR(8, t.tm_mday);
+ WRITE_VAR(9, t.tm_hour);
+ WRITE_VAR(10, t.tm_min);
+ WRITE_VAR(11, t.tm_sec);
}
void Inter::storeMouse() {
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 629ac31901..9e979cbab9 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
@@ -555,10 +553,12 @@ bool ScummEngine::loadInfos(Common::InSaveFile *file, InfoStuff *stuff) {
// For header version 1, we load the data in with our old method
if (section.version == 1) {
- time_t tmp = section.timeTValue;
- tm *curTime = localtime(&tmp);
- stuff->date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF;
- stuff->time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF;
+ //time_t tmp = section.timeTValue;
+ //tm *curTime = localtime(&tmp);
+ //stuff->date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF;
+ //stuff->time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF;
+ stuff->date = 0;
+ stuff->time = 0;
}
if (section.version >= 2) {
@@ -588,11 +588,12 @@ void ScummEngine::saveInfos(Common::OutSaveFile* file) {
// still save old format for older versions
section.timeTValue = time(0);
section.playtime = _system->getMillis() / 1000 - _engineStartTime;
-
- time_t curTime_ = time(0);
- tm *curTime = localtime(&curTime_);
- section.date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF;
- section.time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF;
+
+ tm curTime;
+ _system->getTimeAndDate(curTime);
+
+ section.date = (curTime.tm_mday & 0xFF) << 24 | ((curTime.tm_mon + 1) & 0xFF) << 16 | (curTime.tm_year + 1900) & 0xFFFF;
+ section.time = (curTime.tm_hour & 0xFF) << 8 | (curTime.tm_min) & 0xFF;
file->writeUint32BE(section.type);
file->writeUint32BE(section.version);
diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp
index 8696b83fe2..4a2e8fd0bb 100644
--- a/engines/scumm/script_v6.cpp
+++ b/engines/scumm/script_v6.cpp
@@ -23,9 +23,8 @@
*
*/
-
-
#include "common/config-manager.h"
+#include "common/system.h"
#include "scumm/actor.h"
#include "scumm/charset.h"
@@ -3003,19 +3002,17 @@ void ScummEngine_v6::o6_pickVarRandom() {
}
void ScummEngine_v6::o6_getDateTime() {
- struct tm *t;
- time_t now = time(NULL);
-
- t = localtime(&now);
+ struct tm t;
+ _system->getTimeAndDate(t);
- VAR(VAR_TIMEDATE_YEAR) = t->tm_year;
- VAR(VAR_TIMEDATE_MONTH) = t->tm_mon;
- VAR(VAR_TIMEDATE_DAY) = t->tm_mday;
- VAR(VAR_TIMEDATE_HOUR) = t->tm_hour;
- VAR(VAR_TIMEDATE_MINUTE) = t->tm_min;
+ VAR(VAR_TIMEDATE_YEAR) = t.tm_year;
+ VAR(VAR_TIMEDATE_MONTH) = t.tm_mon;
+ VAR(VAR_TIMEDATE_DAY) = t.tm_mday;
+ VAR(VAR_TIMEDATE_HOUR) = t.tm_hour;
+ VAR(VAR_TIMEDATE_MINUTE) = t.tm_min;
if (_game.version == 8)
- VAR(VAR_TIMEDATE_SECOND) = t->tm_sec;
+ VAR(VAR_TIMEDATE_SECOND) = t.tm_sec;
}
void ScummEngine_v6::o6_getPixel() {