diff --git a/code/__HELPERS/files.dm b/code/__HELPERS/files.dm
index 5001a3541e..f515668dfb 100644
--- a/code/__HELPERS/files.dm
+++ b/code/__HELPERS/files.dm
@@ -43,7 +43,7 @@
/client/proc/file_spam_check()
var/time_to_wait = GLOB.fileaccess_timer - world.time
if(time_to_wait > 0)
- to_chat(src, "Error: file_spam_check(): Spam. Please wait [round(time_to_wait/10)] seconds.")
+ to_chat(src, "Error: file_spam_check(): Spam. Please wait [DisplayTimeText(time_to_wait)].")
return 1
GLOB.fileaccess_timer = world.time + FTPDELAY
return 0
diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index 5bcc66eeda..c040e264e6 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -421,7 +421,7 @@
SEND_SOUND(M, 'sound/misc/notice2.ogg') //Alerting them to their consideration
if(flashwindow)
window_flash(M.client)
- switch(ignore_category ? askuser(M,Question,"Please answer in [poll_time/10] seconds!","Yes","No","Never for this round", StealFocus=0, Timeout=poll_time) : askuser(M,Question,"Please answer in [poll_time/10] seconds!","Yes","No", StealFocus=0, Timeout=poll_time))
+ switch(ignore_category ? askuser(M,Question,"Please answer in [DisplayTimeText(poll_time)]!","Yes","No","Never for this round", StealFocus=0, Timeout=poll_time) : askuser(M,Question,"Please answer in [DisplayTimeText(poll_time)]!","Yes","No", StealFocus=0, Timeout=poll_time))
if(1)
to_chat(M, "Choice registered: Yes.")
if(time_passed + poll_time <= world.time)
diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm
index 8374b305ad..61a6866fe2 100644
--- a/code/__HELPERS/maths.dm
+++ b/code/__HELPERS/maths.dm
@@ -219,3 +219,8 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
new_x = Clamp(new_x, 0, world.maxx)
new_y = Clamp(new_y, 0, world.maxy)
return locate(new_x, new_y, starting.z)
+
+/proc/round_down(num)
+ if(round(num) != num)
+ return round(num--)
+ else return num
diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm
index 546935e697..630d87a82a 100644
--- a/code/__HELPERS/time.dm
+++ b/code/__HELPERS/time.dm
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
//Returns the world time in english
/proc/worldtime2text()
return gameTimestamp("hh:mm:ss", world.time)
@@ -50,3 +51,153 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
return 5
else
return 1
+=======
+//Returns the world time in english
+/proc/worldtime2text()
+ return gameTimestamp("hh:mm:ss", world.time)
+
+/proc/time_stamp(format = "hh:mm:ss", show_ds)
+ var/time_string = time2text(world.timeofday, format)
+ return show_ds ? "[time_string]:[world.timeofday % 10]" : time_string
+
+/proc/gameTimestamp(format = "hh:mm:ss", wtime=null)
+ if(!wtime)
+ wtime = world.time
+ return time2text(wtime - GLOB.timezoneOffset + SSticker.gametime_offset - SSticker.round_start_time, format)
+
+/* Returns 1 if it is the selected month and day */
+/proc/isDay(month, day)
+ if(isnum(month) && isnum(day))
+ var/MM = text2num(time2text(world.timeofday, "MM")) // get the current month
+ var/DD = text2num(time2text(world.timeofday, "DD")) // get the current day
+ if(month == MM && day == DD)
+ return 1
+
+ // Uncomment this out when debugging!
+ //else
+ //return 1
+
+//returns timestamp in a sql and ISO 8601 friendly format
+/proc/SQLtime(timevar)
+ if(!timevar)
+ timevar = world.realtime
+ return time2text(timevar, "YYYY-MM-DD hh:mm:ss")
+
+
+GLOBAL_VAR_INIT(midnight_rollovers, 0)
+GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
+/proc/update_midnight_rollover()
+ if (world.timeofday < GLOB.rollovercheck_last_timeofday) //TIME IS GOING BACKWARDS!
+ return GLOB.midnight_rollovers++
+ return GLOB.midnight_rollovers
+
+/proc/weekdayofthemonth()
+ var/DD = text2num(time2text(world.timeofday, "DD")) // get the current day
+ switch(DD)
+ if(8 to 13)
+ return 2
+ if(14 to 20)
+ return 3
+ if(21 to 27)
+ return 4
+ if(28 to INFINITY)
+ return 5
+ else
+ return 1
+
+//Takes a value of time in deciseconds.
+//Returns a text value of that number in hours, minutes, or seconds.
+/proc/DisplayTimeText(time_value)
+ var/second = time_value*0.1
+ var/second_adjusted = null
+ var/second_rounded = FALSE
+ var/minute = null
+ var/hour = null
+ var/day = null
+
+ if(!second)
+ return "0 seconds"
+ if(second >= 60)
+ minute = round_down(second/60)
+ second = round(second - (minute*60), 0.1)
+ second_rounded = TRUE
+ if(second) //check if we still have seconds remaining to format, or if everything went into minute.
+ second_adjusted = round(second) //used to prevent '1 seconds' being shown
+ if(day || hour || minute)
+ if(second_adjusted == 1 && second >= 1)
+ second = " and 1 second"
+ else if(second > 1)
+ second = " and [second_adjusted] seconds"
+ else //shows a fraction if seconds is < 1
+ if(second_rounded) //no sense rounding again if it's already done
+ second = " and [second] seconds"
+ else
+ second = " and [round(second, 0.1)] seconds"
+ else
+ if(second_adjusted == 1 && second >= 1)
+ second = "1 second"
+ else if(second > 1)
+ second = "[second_adjusted] seconds"
+ else
+ if(second_rounded)
+ second = "[second] seconds"
+ else
+ second = "[round(second, 0.1)] seconds"
+ else
+ second = null
+
+ if(!minute)
+ return "[second]"
+ if(minute >= 60)
+ hour = round_down(minute/60,1)
+ minute = (minute - (hour*60))
+ if(minute) //alot simpler from here since you don't have to worry about fractions
+ if(minute != 1)
+ if((day || hour) && second)
+ minute = ", [minute] minutes"
+ else if((day || hour) && !second)
+ minute = " and [minute] minutes"
+ else
+ minute = "[minute] minutes"
+ else
+ if((day || hour) && second)
+ minute = ", 1 minute"
+ else if((day || hour) && !second)
+ minute = " and 1 minute"
+ else
+ minute = "1 minute"
+ else
+ minute = null
+
+ if(!hour)
+ return "[minute][second]"
+ if(hour >= 24)
+ day = round_down(hour/24,1)
+ hour = (hour - (day*24))
+ if(hour)
+ if(hour != 1)
+ if(day && (minute || second))
+ hour = ", [hour] hours"
+ else if(day && (!minute || !second))
+ hour = " and [hour] hours"
+ else
+ hour = "[hour] hours"
+ else
+ if(day && (minute || second))
+ hour = ", 1 hour"
+ else if(day && (!minute || !second))
+ hour = " and 1 hour"
+ else
+ hour = "1 hour"
+ else
+ hour = null
+
+ if(!day)
+ return "[hour][minute][second]"
+ if(day > 1)
+ day = "[day] days"
+ else
+ day = "1 day"
+
+ return "[day][hour][minute][second]"
+>>>>>>> 74f5a8c... DisplayTimeText mk2 (#30969)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index e018ccad91..b5dbabb934 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -322,7 +322,7 @@ SUBSYSTEM_DEF(air)
EG.dismantle()
CHECK_TICK
- var/msg = "HEY! LISTEN! [(world.timeofday - timer)/10] Seconds were wasted processing [starting_ats] turf(s) (connected to [ending_ats] other turfs) with atmos differences at round start."
+ var/msg = "HEY! LISTEN! [DisplayTimeText(world.timeofday - timer)] were wasted processing [starting_ats] turf(s) (connected to [ending_ats] other turfs) with atmos differences at round start."
to_chat(world, "[msg]")
warning(msg)
diff --git a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm
index ec34cfb8ed..87b06cd587 100644
--- a/code/controllers/subsystem/server_maint.dm
+++ b/code/controllers/subsystem/server_maint.dm
@@ -29,7 +29,7 @@ SUBSYSTEM_DEF(server_maint)
var/cmob = C.mob
if(!(isobserver(cmob) || (isdead(cmob) && C.holder)))
log_access("AFK: [key_name(C)]")
- to_chat(C, "You have been inactive for more than [config.afk_period / 600] minutes and have been disconnected.")
+ to_chat(C, "You have been inactive for more than [DisplayTimeText(config.afk_period)] and have been disconnected.")
qdel(C)
if (!(!C || world.time - C.connection_time < PING_BUFFER_TIME || C.inactivity >= (wait-1)))
diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm
index 4770689778..da003145c5 100644
--- a/code/controllers/subsystem/shuttle.dm
+++ b/code/controllers/subsystem/shuttle.dm
@@ -178,7 +178,7 @@ SUBSYSTEM_DEF(shuttle)
emergency = backup_shuttle
if(world.time - SSticker.round_start_time < config.shuttle_refuel_delay)
- to_chat(user, "The emergency shuttle is refueling. Please wait another [abs(round(((world.time - SSticker.round_start_time) - config.shuttle_refuel_delay)/600))] minutes before trying again.")
+ to_chat(user, "The emergency shuttle is refueling. Please wait [DisplayTimeText((world.time - SSticker.round_start_time) - config.shuttle_refuel_delay)] before trying again.")
return
switch(emergency.mode)
diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm
index 220c0e355a..7c10883c1d 100755
--- a/code/controllers/subsystem/ticker.dm
+++ b/code/controllers/subsystem/ticker.dm
@@ -505,7 +505,7 @@ SUBSYSTEM_DEF(ticker)
end_state.count()
var/station_integrity = min(PERCENT(GLOB.start_state.score(end_state)), 100)
- to_chat(world, "
[GLOB.TAB]Shift Duration: [round(world.time / 36000)]:[add_zero("[world.time / 600 % 60]", 2)]:[world.time / 100 % 6][world.time / 100 % 10]")
+ to_chat(world, "
[GLOB.TAB]Shift Duration: [DisplayTimeText(world.time - SSticker.round_start_time)]")
to_chat(world, "
[GLOB.TAB]Station Integrity: [mode.station_was_nuked ? "Destroyed" : "[station_integrity]%"]")
if(mode.station_was_nuked)
SSticker.news_report = STATION_DESTROYED_NUKE
diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm
index 0dbc7c5d3a..0ea16b32d8 100644
--- a/code/controllers/subsystem/vote.dm
+++ b/code/controllers/subsystem/vote.dm
@@ -169,7 +169,7 @@ SUBSYSTEM_DEF(vote)
admin = TRUE
if(next_allowed_time > world.time && !admin)
- to_chat(usr, "A vote was initiated recently, you must wait roughly [(next_allowed_time-world.time)/10] seconds before a new vote can be started!")
+ to_chat(usr, "A vote was initiated recently, you must wait [DisplayTimeText(next_allowed_time-world.time)] before a new vote can be started!")
return 0
reset()
@@ -198,7 +198,7 @@ SUBSYSTEM_DEF(vote)
if(mode == "custom")
text += "\n[question]"
log_vote(text)
- to_chat(world, "\n[text]\nType vote or click here to place your votes.\nYou have [config.vote_period/10] seconds to vote.")
+ to_chat(world, "\n[text]\nType vote or click here to place your votes.\nYou have [DisplayTimeText(config.vote_period)] to vote.")
time_remaining = round(config.vote_period/10)
for(var/c in GLOB.clients)
var/client/C = c
diff --git a/code/game/gamemodes/blob/overmind.dm b/code/game/gamemodes/blob/overmind.dm
index e22b2747e0..9f8a44bed2 100644
--- a/code/game/gamemodes/blob/overmind.dm
+++ b/code/game/gamemodes/blob/overmind.dm
@@ -57,7 +57,7 @@
if(!placed)
if(manualplace_min_time && world.time >= manualplace_min_time)
to_chat(src, "You may now place your blob core.")
- to_chat(src, "You will automatically place your blob core in [round((autoplace_max_time - world.time)/600, 0.5)] minutes.")
+ to_chat(src, "You will automatically place your blob core in [DisplayTimeText(autoplace_max_time - world.time)].")
manualplace_min_time = 0
if(autoplace_max_time && world.time >= autoplace_max_time)
place_blob_core(base_point_rate, 1)
diff --git a/code/game/gamemodes/blob/powers.dm b/code/game/gamemodes/blob/powers.dm
index 6baf8b4dbe..026183d951 100644
--- a/code/game/gamemodes/blob/powers.dm
+++ b/code/game/gamemodes/blob/powers.dm
@@ -365,5 +365,5 @@
to_chat(src, "Shortcuts: Click = Expand Blob | Middle Mouse Click = Rally Spores | Ctrl Click = Create Shield Blob | Alt Click = Remove Blob")
to_chat(src, "Attempting to talk will send a message to all other overminds, allowing you to coordinate with them.")
if(!placed && autoplace_max_time <= world.time)
- to_chat(src, "You will automatically place your blob core in [round((autoplace_max_time - world.time)/600, 0.5)] minutes.")
+ to_chat(src, "You will automatically place your blob core in [DisplayTimeText(autoplace_max_time - world.time)].")
to_chat(src, "You [manualplace_min_time ? "will be able to":"can"] manually place your blob core by pressing the Place Blob Core button in the bottom right corner of the screen.")
diff --git a/code/game/gamemodes/clock_cult/clock_effects/spatial_gateway.dm b/code/game/gamemodes/clock_cult/clock_effects/spatial_gateway.dm
index a6eb5fb4e7..9b1ef66c9e 100644
--- a/code/game/gamemodes/clock_cult/clock_effects/spatial_gateway.dm
+++ b/code/game/gamemodes/clock_cult/clock_effects/spatial_gateway.dm
@@ -207,7 +207,7 @@
time_duration = round(time_duration * (2 * efficiency), 1)
CO.active = TRUE //you'd be active in a second but you should update immediately
invoker.visible_message("The air in front of [invoker] ripples before suddenly tearing open!", \
- "With a word, you rip open a [two_way ? "two-way":"one-way"] rift to [input_target_key]. It will last for [time_duration / 10] seconds and has [gateway_uses] use[gateway_uses > 1 ? "s" : ""].")
+ "With a word, you rip open a [two_way ? "two-way":"one-way"] rift to [input_target_key]. It will last for [DisplayTimeText(time_duration)] and has [gateway_uses] use[gateway_uses > 1 ? "s" : ""].")
var/obj/effect/clockwork/spatial_gateway/S1 = new(issrcobelisk ? get_turf(src) : get_step(get_turf(invoker), invoker.dir))
var/obj/effect/clockwork/spatial_gateway/S2 = new(istargetobelisk ? get_turf(target) : get_step(get_turf(target), target.dir))
diff --git a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm
index eecfec7780..bf76cdb2f7 100644
--- a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm
+++ b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm
@@ -318,23 +318,10 @@
if(servants > SCRIPT_SERVANT_REQ)
servants -= SCRIPT_SERVANT_REQ
production_time += min(SLAB_SERVANT_SLOWDOWN * servants, SLAB_SLOWDOWN_MAXIMUM)
- var/production_text_addon = ""
if(production_time != SLAB_PRODUCTION_TIME+SLAB_SLOWDOWN_MAXIMUM)
- production_text_addon = ", which increases for each human or silicon Servant above [SCRIPT_SERVANT_REQ]"
- production_time = production_time/600
- var/list/production_text
- if(round(production_time))
- production_text = list("[round(production_time)] minute\s")
- if(production_time != round(production_time))
- production_time -= round(production_time)
- production_time *= 60
- if(!LAZYLEN(production_text))
- production_text = list("[round(production_time, 1)] second\s")
- else
- production_text += " and [round(production_time, 1)] second\s"
- production_text += ""
- production_text += production_text_addon
- production_text = production_text.Join()
+ production_time = "[DisplayTimeText(production_time)], which increases for each human or silicon Servant above [SCRIPT_SERVANT_REQ]"
+ else
+ production_time = "[DisplayTimeText(production_time)]"
textlist = list("