aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Battaglia2010-03-06 13:49:20 +0000
committerFabio Battaglia2010-03-06 13:49:20 +0000
commit5f6e0c3e94491b176bf04b759320b0cf324332aa (patch)
treeafa788d99b94169f60dd85f1a5e38adc997f5554
parent4f74853f93fe3c598b22163b42d7f4a2a22b712c (diff)
downloadscummvm-rg350-5f6e0c3e94491b176bf04b759320b0cf324332aa.tar.gz
scummvm-rg350-5f6e0c3e94491b176bf04b759320b0cf324332aa.tar.bz2
scummvm-rg350-5f6e0c3e94491b176bf04b759320b0cf324332aa.zip
N64: Use mips timer to partially simulate an RTC for the n64 port
svn-id: r48170
-rw-r--r--backends/platform/n64/osys_n64_base.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index cde5208bda..746de23403 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -860,14 +860,18 @@ Common::TimerManager *OSystem_N64::getTimerManager() {
}
void OSystem_N64::getTimeAndDate(TimeDate &t) const {
- // No clock inside the N64
- // TODO: use getMillis to provide some kind of time-counting feature?
- t.tm_sec = 0;
- t.tm_min = 0;
- t.tm_hour = 0;
- t.tm_mday = 0;
+ // No RTC inside the N64, read mips timer to simulate
+ // passing of time, not a perfect solution, but can't think
+ // of anything better.
+
+ uint32 now = getMilliTick();
+
+ t.tm_sec = (now / 1000) % 60;
+ t.tm_min = ((now / 1000) / 60) % 60;
+ t.tm_hour = (((now / 1000) / 60) / 60) % 24;
+ t.tm_mday = 1;
t.tm_mon = 0;
- t.tm_year = 0;
+ t.tm_year = 1900;
return;
}