Problems with SetTime function?
ELadner
Member Posts: 9
Has anybody had problems with SetTime?
In a module OnLoad event, we set the date/time based on some function based on the real world time. Setting the date with SetDate() is spot on, but the SetTime function appears flaky. Sometimes it will set the time correctly, sometimes it's 2-3 hours ahead of what's requested.
For example:
This:
In a module OnLoad event, we set the date/time based on some function based on the real world time. Setting the date with SetDate() is spot on, but the SetTime function appears flaky. Sometimes it will set the time correctly, sometimes it's 2-3 hours ahead of what's requested.
For example:
This:
debug("Internal date is " + IntToString(GetCalendarYear()) + "/" + iht_pad(GetCalendarMonth()) + "/" + iht_pad(GetCalendarDay()) + " " + iht_pad(GetTimeHour()) + ":" + iht_pad(GetTimeMinute())); struct date d = GetIGDate(); debug("Date Args: " + IntToString(d.year) + ", " + IntToString(d.month) + ", " + IntToString(d.day)); SetCalendar(d.year, d.month, d.day); debug("Internal date is " + IntToString(GetCalendarYear()) + "/" + iht_pad(GetCalendarMonth()) + "/" + iht_pad(GetCalendarDay()) + " " + iht_pad(GetTimeHour()) + ":" + iht_pad(GetTimeMinute())); debug("Time Args: " + IntToString(d.hour) + ", " + IntToString(d.min) + ", 0, 0"); SetTime(d.hour, d.min, 0, 0); debug("Internal date is " + IntToString(GetCalendarYear()) + "/" + iht_pad(GetCalendarMonth()) + "/" + iht_pad(GetCalendarDay()) + " " + iht_pad(GetTimeHour()) + ":" + iht_pad(GetTimeMinute())); WriteTimestampedLogEntry("================="); SetTime(d.hour, d.min+1, 1, 1); debug("Internal date is " + IntToString(GetCalendarYear()) + "/" + iht_pad(GetCalendarMonth()) + "/" + iht_pad(GetCalendarDay()) + " " + iht_pad(GetTimeHour()) + ":" + iht_pad(GetTimeMinute())); WriteTimestampedLogEntry("================="); WriteTimestampedLogEntry("Date set to " + GetDateString()); debug("Internal date is " + IntToString(GetCalendarYear()) + "/" + iht_pad(GetCalendarMonth()) + "/" + iht_pad(GetCalendarDay()) + " " + iht_pad(GetTimeHour()) + ":" + iht_pad(GetTimeMinute()));produces this logging:
[Mon Jan 7 12:02:54] Loading Module: module000 [Mon Jan 7 12:02:54] Internal date is 1330/01/01 00:00 [Mon Jan 7 12:02:54] Date Args: 1359, 6, 6 [Mon Jan 7 12:02:54] Time Args: 18, 3, 0, 0 [Mon Jan 7 12:02:54] Setting date to 1359/06/06 18:03 [Mon Jan 7 12:02:54] Setting date to 1359/06/06 18:03 [Mon Jan 7 12:02:54] Internal date is 1359/06/06 19:00I've checked that's it not overflowing or trying to set time backwards.. it's odd that I sent it 18:03, but it sets to 19:00. And the discrepancy is not always just one hour. Sometimes. it's 2 or 3 hours off. Or even 24+ hours off (adding the time bumps the day up, even through hours and minutes are both less than 24 and 60 respectively)
0
Comments
Check out this train wreck.. Note the odd incrementing of the minute (base 4?) and the rollover of the day at hour 14. What the heck?
This code: Produces this output:
SetTime bug