aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-10 11:01:40 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit43cee5fb0f4fee9669098c21777ac9b41865bee1 (patch)
tree92bfa00875a5092adbb4c0ae4e85e2371a55e6bb /engines
parentcde50e00edea1c0cc0235aa814501038e6a1792c (diff)
downloadscummvm-rg350-43cee5fb0f4fee9669098c21777ac9b41865bee1.tar.gz
scummvm-rg350-43cee5fb0f4fee9669098c21777ac9b41865bee1.tar.bz2
scummvm-rg350-43cee5fb0f4fee9669098c21777ac9b41865bee1.zip
GLK: Fix setTime converting seconds to a date/time structure
Diffstat (limited to 'engines')
-rw-r--r--engines/gargoyle/time.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/engines/gargoyle/time.cpp b/engines/gargoyle/time.cpp
index 9a99d3bfcc..39c3b7cfd5 100644
--- a/engines/gargoyle/time.cpp
+++ b/engines/gargoyle/time.cpp
@@ -63,15 +63,17 @@ TimeAndDate::operator Timestamp() const {
void TimeAndDate::setTime(const TimeSeconds &ts) {
TimeSeconds total = ts;
- int daysInYear, secsInYear;
+ int daysInYear = 0, secsInYear = 0;
// Figure out the year
this->year = 1969;
do {
++this->year;
- daysInYear = ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 365 : 365;
+ total -= secsInYear;
+
+ daysInYear = ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 366 : 365;
secsInYear = daysInYear * 24 * 60 * 60;
- } while (total >= daysInYear);
+ } while (total >= secsInYear);
// Figure out month and day
int dayInYear = total / (24 * 60 * 60);