blob: c7e768292384dee84d8d7e06ae27771a1752a559 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 #include <time.h>
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstrad59c3892019-11-28 20:53:39 +01004 int mktime(int *ts)
MG Mud User88f12472016-06-24 23:31:02 +02005
Zesstra715ec202025-07-09 22:18:31 +02006DESCRIPTION
7 If the argument <ts> is an array with 9 elements (int) according to
8 the result of localtime(), this function returns the number of seconds
9 passed since the epoch (00:00:00 UTC, January 1, 1970).
10 mktime() interprets the input data according to the current timezone
11 setting of the host system.
12 This can be used to store a date or time as an integer value or to
13 compute differences betweens two different dates or times.
MG Mud User88f12472016-06-24 23:31:02 +020014
Zesstra715ec202025-07-09 22:18:31 +020015 The array <ts> has to have the following structure:
16 int TM_SEC (0): seconds (0..59)
17 int TM_MIN (1): minutes (0..59)
18 int TM_HOUR (2): hours (0..23)
19 int TM_MDAY (3): day of month (1..31)
20 int TM_MON (4): day of year (0..11)
21 int TM_YEAR (5): year (e.g. 2001)
22 int TM_WDAY (6): day of week (0..6, sunday = 0)
23 int TM_YDAY (7): day of year (0..365)
24 inz TM_ISDST (8): Daylight Saving Time (1,0,-1)
MG Mud User88f12472016-06-24 23:31:02 +020025
Zesstra715ec202025-07-09 22:18:31 +020026 TM_YDAY and TM_WDAY are ignored and can contain arbitrary
27 integer values.
28 TM_ISDST can be 1 (daylight saving time in effect), 0 (DST not in
29 effect) or -1. A value of -1 causes the mktime() function to attempt
30 to divine whether daylight saving time is in effect for the specified
31 time.
MG Mud User88f12472016-06-24 23:31:02 +020032
Zesstra715ec202025-07-09 22:18:31 +020033EXAMPLES
34 A date and time (user input) shall be stored as unix timestamp:
35 // "Wed Oct 24 10:48:00 2007" corresponds to the returned time stamp:
36 int unixtime = mktime( ({0, 48, 09, 24, 09, 2007, 0, 01, 0}) );
Zesstra5481d492021-04-08 20:07:06 +020037
Zesstra715ec202025-07-09 22:18:31 +020038HISTORY
39 Introduced in LDMud 3.3.718.
MG Mud User88f12472016-06-24 23:31:02 +020040
Zesstra715ec202025-07-09 22:18:31 +020041SEE ALSO
Zesstra5481d492021-04-08 20:07:06 +020042 ctime(E), gmtime(E), localtime(E), time(E), utime(E)