From ff5216a2a55949cc4c25b8463064f297bc14a4f9 Mon Sep 17 00:00:00 2001 From: Birdtalon Date: Wed, 27 Sep 2017 23:58:34 +0100 Subject: [PATCH] adds seconds_to_time() proc --- code/__HELPERS/time.dm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm index 872f299479c..4b71a2c7162 100644 --- a/code/__HELPERS/time.dm +++ b/code/__HELPERS/time.dm @@ -29,7 +29,7 @@ /proc/time_stamp() return time2text(world.timeofday, "hh:mm:ss") - + /proc/gameTimestamp(format = "hh:mm:ss") // Get the game time in text return time2text(world.time - timezoneOffset + 432000, format) @@ -61,6 +61,12 @@ proc/isDay(var/month, var/day) */ /proc/stop_watch(wh) return round(0.1 * (TimeOfGame - wh), 0.1) - + /proc/month2number(month) - return month_names.Find(month) \ No newline at end of file + return month_names.Find(month) + +//Take a value in seconds and returns a string of minutes and seconds in the format X minute(s) and X seconds. +/proc/seconds_to_time(var/seconds as num) + var/numSeconds = seconds % 60 + var/numMinutes = (seconds - numSeconds) / 60 + return "[numMinutes] [numMinutes > 1 ? "minutes" : "minute"] and [numSeconds] seconds." \ No newline at end of file