ID:1720328
 
(See the best response by Nadrew.)
So I'm using world time to dictate cooldowns. However, there is a problem. World time is resets everytime it restarts, crashes, etc. So if a cooldown was set at six minutes in and the server resets, the c/d is now six minutes + original cooldown.

mob
var
list/cds = list()

proc
setCD(cooldown, delay=0, time=0)
if(delay)
time = world.time + delay
cds[cooldown] = time
return time

getCD(cooldown)
if(cooldown in cds)
cdc = cds[cooldown] - world.time
return cds[cooldown] - world.time
else
return 0


Using Ter's because it was pretty easy. I made a variable called cdc which gets the cooldown so it can be used to check and see if its larger than what it should be. Problem now is that the cooldown is never constant. If I set a CD to 600 (6 minutes) it will never be always 600. Sometimes 700 even. Why does it vary? Is there any way to efficiently do this?
I just wrote an example of how you can do cooldowns if you're interested.
http://www.byond.com/developer/Zecronious/Timer

As long as you're saving the player the Timer object inside the player will be saved too. No world.time at all.
Best response
You'd use world.realtime instead, it's a more robust value than world.time and the differences would properly retain throughout restarts and whatnot. You'd use basically what you have now, store the value when the cooldown would expire and you can compare that against the current time as needed to see how long is left -- and of course if the current time is greater than the expiration time, remove the cooldown.
In response to Zecronious
The point of using stuff like world.time is to avoid a lot of calls to sleep and spawn.