From 6d47c2f95c14e1c679483f68da171817ecc46718 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Fri, 8 May 2020 10:09:40 -0400 Subject: [PATCH] Further time fixes --- code/_helpers/time.dm | 9 ++++++++- code/game/world.dm | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm index db0a22a721e..6e63dabb45a 100644 --- a/code/_helpers/time.dm +++ b/code/_helpers/time.dm @@ -46,7 +46,7 @@ var/next_station_date_change = 1 DAY #define station_time_in_ds (GLOB.roundstart_hour HOURS + round_duration_in_ds) /proc/stationtime2text() - return time2text(station_time_in_ds, "hh:mm") //For some reason, this is not accurate. It's expecting some other kind of times, maybe? Like ones from world.realtime? + return time2text(station_time_in_ds + GLOB.timezoneOffset, "hh:mm") /proc/stationdate2text() var/update_time = FALSE @@ -65,6 +65,13 @@ var/next_station_date_change = 1 DAY var/time_portion = time2text(world.timeofday, "hh:mm:ss") return "[date_portion]T[time_portion]" +/proc/get_timezone_offset() + var/midnight_gmt_here = text2num(time2text(0,"hh")) * 36000 + if(midnight_gmt_here > 12 HOURS) + return 24 HOURS - midnight_gmt_here + else + return midnight_gmt_here + /proc/gameTimestamp(format = "hh:mm:ss", wtime=null) if(!wtime) wtime = world.time diff --git a/code/game/world.dm b/code/game/world.dm index e4735c93157..3385a494aea 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -25,7 +25,7 @@ // if(config && config.log_runtime) // log = file("data/logs/runtime/[time2text(world.realtime,"YYYY-MM-DD-(hh-mm-ss)")]-runtime.log") - GLOB.timezoneOffset = text2num(time2text(0,"hh")) * 36000 + GLOB.timezoneOffset = get_timezone_offset() callHook("startup") init_vchat()