Manual:DIL Manual/realtime
Jump to navigation
Jump to search
Contents
realtime
Variable (integer, read-only).
realtime : integer
The real time, in seconds since 1 January 1970 UTC: what time(NULL) gives in C.
Notes
- It is the real clock:
vme -wandwtimewarpdon't move it, unlike mudhour and the other mud-time variables. - asctime() turns it into a readable date:
asctime(realtime). pc.birthis on the same clock, sorealtime - pc.birthis a player's age in real seconds.- To keep a moment across reboots or on a unit, store
itoa(realtime)in an extra and compare withatoi()later, as death.zon does with severed heads. - It is a 32-bit signed integer, so it overflows on 19 January 2038.
Example
dilbegin rot_away();
var
e : extraptr;
code
{
heartbeat := PULSE_SEC * 15;
if (self.extra.["$made"] == null)
addextra(self.extra, {"$made"}, itoa(realtime));
:loop:
pause;
e := "$made" in self.extra;
if (e == null)
goto loop;
if ((realtime - atoi(e.descr)) > 1800)
{
act("$1n rots away.", A_SOMEONE, self, null, null, TO_ROOM);
destroy(self);
quit;
}
goto loop;
}
dilend
An object that rots away half an hour (1800 real seconds) after it first ran, as the heads in death.zon. The extra is looked up again after each pause, because extra variables are cleared at every wake.