mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Fix rollover even harder
This commit is contained in:
@@ -125,8 +125,31 @@ GLOBAL_VAR_INIT(round_start_time, 0)
|
|||||||
/var/midnight_rollovers = 0
|
/var/midnight_rollovers = 0
|
||||||
/var/rollovercheck_last_timeofday = 0
|
/var/rollovercheck_last_timeofday = 0
|
||||||
/proc/update_midnight_rollover()
|
/proc/update_midnight_rollover()
|
||||||
|
<<<<<<< HEAD
|
||||||
if (world.timeofday < rollovercheck_last_timeofday) //TIME IS GOING BACKWARDS!
|
if (world.timeofday < rollovercheck_last_timeofday) //TIME IS GOING BACKWARDS!
|
||||||
midnight_rollovers += 1
|
midnight_rollovers += 1
|
||||||
|
||||||| parent of 6c511626fc... Merge pull request #11456 from VOREStation/Arokha/timey
|
||||||
|
// Day has wrapped (world.timeofday drops to 0 at the start of each real day)
|
||||||
|
if (world.timeofday < rollovercheck_last_timeofday)
|
||||||
|
// Compare the last wrap date (or server startup date) to our current date
|
||||||
|
var/curday = text2num(time2text(world.timeofday, "DD"))
|
||||||
|
// If the date is the same as the startup or last wrap, we should avoid wrapping, may be clock adjustment
|
||||||
|
// note that this won't protect against going from 00:01 to 23:59 and crossing the boundary again
|
||||||
|
if(rollover_safety_date != curday)
|
||||||
|
midnight_rollovers++
|
||||||
|
rollover_safety_date = curday
|
||||||
|
else
|
||||||
|
warning("Time rollover error: world.timeofday decreased from previous check, but date remained the same. System clock?")
|
||||||
|
=======
|
||||||
|
// Day has wrapped (world.timeofday drops to 0 at the start of each real day)
|
||||||
|
if (world.timeofday < rollovercheck_last_timeofday)
|
||||||
|
// If the day started/last wrap was < 12 hours ago, this is spurious
|
||||||
|
if(rollover_safety_date < world.realtime - (12 HOURS))
|
||||||
|
midnight_rollovers++
|
||||||
|
rollover_safety_date = world.realtime
|
||||||
|
else
|
||||||
|
warning("Time rollover error: world.timeofday decreased from previous check, but the day or last rollover is less than 12 hours old. System clock?")
|
||||||
|
>>>>>>> 6c511626fc... Merge pull request #11456 from VOREStation/Arokha/timey
|
||||||
rollovercheck_last_timeofday = world.timeofday
|
rollovercheck_last_timeofday = world.timeofday
|
||||||
return midnight_rollovers
|
return midnight_rollovers
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
#define RECOMMENDED_VERSION 501
|
#define RECOMMENDED_VERSION 501
|
||||||
/world/New()
|
/world/New()
|
||||||
world_startup_time = world.timeofday
|
world_startup_time = world.timeofday
|
||||||
|
<<<<<<< HEAD
|
||||||
|
||||||| parent of 6c511626fc... Merge pull request #11456 from VOREStation/Arokha/timey
|
||||||
|
rollover_safety_date = text2num(time2text(world_startup_time, "DD"))
|
||||||
|
=======
|
||||||
|
rollover_safety_date = world.realtime - world.timeofday // 00:00 today (ish, since floating point error with world.realtime) of today
|
||||||
|
>>>>>>> 6c511626fc... Merge pull request #11456 from VOREStation/Arokha/timey
|
||||||
to_world_log("Map Loading Complete")
|
to_world_log("Map Loading Complete")
|
||||||
//logs
|
//logs
|
||||||
//VOREStation Edit Start
|
//VOREStation Edit Start
|
||||||
|
|||||||
Reference in New Issue
Block a user