MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | #include <time.h> |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 4 | int * gmtime(int clock) |
| 5 | int * gmtime(int *uclock) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 6 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 7 | DESCRIPTION |
| 8 | Interpret the argument clock as number of seconds since Jan, |
| 9 | 1st, 1970, 0:00, and return the time in UTC in a nice structure. |
| 10 | if <clock> is not specified, time() is used as default. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 12 | Alternatively, accept an array of two ints: the first is <clock> |
| 13 | value as in the first form, the second int is the number of |
| 14 | microseconds elapsed in the current second, which is ignored. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 15 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 16 | The result is an array of integers: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 17 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 18 | int TM_SEC (0) : Seconds (0..59) |
| 19 | int TM_MIN (1) : Minutes (0..59) |
| 20 | int TM_HOUR (2) : Hours (0..23) |
| 21 | int TM_MDAY (3) : Day of the month (1..31) |
| 22 | int TM_MON (4) : Month of the year (0..11) |
| 23 | int TM_YEAR (5) : Year (e.g. 2001) |
| 24 | int TM_WDAY (6) : Day of the week (Sunday = 0) |
| 25 | int TM_YDAY (7) : Day of the year (0..365) |
| 26 | int TM_ISDST (8) : TRUE: Daylight saving time |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 27 | |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 28 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 29 | EXAMPLES |
| 30 | printf("Today is %s\n", |
| 31 | ({ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", |
| 32 | "Friday", "Saturday" })[gmtime()[TM_WDAY]]); |
| 33 | |
| 34 | HISTORY |
| 35 | Introduced in LDMud 3.2.9. |
| 36 | |
| 37 | SEE ALSO |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 38 | ctime(E), localtime(E), time(E), utime(E) |