Files
vgstation13/code/__HELPERS/time.dm
elly1989@rocketmail.com 7b720a20b6 >Moved most of the helper procs into code/__HELPERS. If you see ANYTHING generic enough to be a helper proc just throw it in there and help purge the copypasta 5ever
>Replaced dd_text2list, dd_text2listcase, tg_text2listcase and tg_text2list with text2list and text2listEx. text2list will return a list of each and every character in the string if you set separator=""
>added return_file_text(filepath) which returns text from a file after doing some checks: does the file exist? is the file empty? It prints helpful error messages to the world.log if it runs into problems
>Replaced dd_file2list(filepath, seperator) with file2list(filepath, seperator). It just calls text2list(return_file_text(filepath), seperator). rather than copypasta
>Replaced time_stamp() so it's not as retarded
>Lots of the world setup stuff uses file2list now, rather than file2text -> sanity -> text2list
>Added error() warning() testing() procs. These print messages to world.log with a prefix. e.g. ## ERROR: msg.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4948 316c924e-a436-60f5-8080-3fe189b3f50e
2012-10-24 14:39:36 +00:00

33 lines
1.1 KiB
Plaintext

//Returns the world time in english
proc/worldtime2text()
return "[round(world.time / 36000)+12]:[(world.time / 600 % 60) < 10 ? add_zero(world.time / 600 % 60, 1) : world.time / 600 % 60]"
proc/time_stamp()
return time2text(world.timeofday, "hh:mm:ss")
/* Preserving this so future generations can see how fucking retarded some people are
proc/time_stamp()
var/hh = text2num(time2text(world.timeofday, "hh")) // Set the hour
var/mm = text2num(time2text(world.timeofday, "mm")) // Set the minute
var/ss = text2num(time2text(world.timeofday, "ss")) // Set the second
var/ph
var/pm
var/ps
if(hh < 10) ph = "0"
if(mm < 10) pm = "0"
if(ss < 10) ps = "0"
return"[ph][hh]:[pm][mm]:[ps][ss]"
*/
/* Returns 1 if it is the selected month and day */
proc/isDay(var/month, var/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