Manual:DIL Manual/asctime()
Jump to navigation
Jump to search
asctime()
Function (string). Writes a time in seconds as a date, such as "Mon Nov 18 18:49:08 1996".
asctime(t : integer)
Converts t, a real-world time in seconds since 1 January 1970 (the value of
realtime), into a date and time in the server's time zone. It is
the C library's ctime() without the newline at the end.
Parameters
| Name | Type | Meaning |
|---|---|---|
| t | integer | Seconds since 1 January 1970, usually realtime or a value saved from it.
|
Returns
String: "Www Mmm dd hh:mm:ss yyyy", for instance "Sat Nov 14 09:05:31 2026".
It fails when the argument is a failed value.
Notes
- Give it a variable or an expression, never a bare number. vmc compiles
asctime(0)orasctime(3600 * 24)without its argument, and running that stops the server.asctime(realtime),asctime(t)orasctime(pc.birth)are fine.
- DIL integers are 32 bits, so dates after January 2038 can't be shown.
- For the time in the game world use mudhour(),
mudday() and the like.
Example
dilbegin bug_note(pc : unitptr, txt : string);
var
i : integer;
code
{
i := flog("bugs", pc.name + " " + asctime(realtime) + ": " + txt + "<br/>", "a");
sendtext("Thank you, it is noted.<br/>", pc);
quit;
}
dilend
Writes a player's report with the date and time into a log file, as the bug
command in commands.zon does.