Files
vgstation13/code/controllers/Processes/ticker.dm
2015-11-20 03:17:06 +01:00

37 lines
848 B
Plaintext

var/global/datum/controller/process/ticker/tickerProcess
/datum/controller/process/ticker
var/lastTickerTimeDuration
var/lastTickerTime
schedule_interval = 20 // every 2 seconds
/datum/controller/process/ticker/setup()
name = "ticker"
lastTickerTime = world.timeofday
if(!ticker)
ticker = new
tickerProcess = src
spawn(0)
if(ticker)
ticker.pregame()
/datum/controller/process/ticker/doWork()
scheck()
var/currentTime = world.timeofday
if(currentTime < lastTickerTime) // check for midnight rollover
lastTickerTimeDuration = (currentTime - (lastTickerTime - TICKS_IN_DAY)) / TICKS_IN_SECOND
else
lastTickerTimeDuration = (currentTime - lastTickerTime) / TICKS_IN_SECOND
lastTickerTime = currentTime
ticker.process()
/datum/controller/process/ticker/proc/getLastTickerTimeDuration()
return lastTickerTimeDuration