From 5f6e0c3e94491b176bf04b759320b0cf324332aa Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Sat, 6 Mar 2010 13:49:20 +0000 Subject: N64: Use mips timer to partially simulate an RTC for the n64 port svn-id: r48170 --- backends/platform/n64/osys_n64_base.cpp | 18 +++++++++++------- 1 file 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; } -- cgit v1.2.3