php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
timelib.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2015-2024 Derick Rethans
5 * Copyright (c) 2018,2021 MongoDB, Inc.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26#ifndef __TIMELIB_H__
27#define __TIMELIB_H__
28
29#ifdef HAVE_TIMELIB_CONFIG_H
30# include "timelib_config.h"
31#endif
32
33#define TIMELIB_VERSION 202212
34#define TIMELIB_EXTENDED_VERSION 20221201
35#define TIMELIB_ASCII_VERSION "2022.12"
36
37#include <stdlib.h>
38#include <stdbool.h>
39#include <limits.h>
40#include <inttypes.h>
41
42# ifndef HAVE_INT32_T
43# if SIZEOF_INT == 4
44typedef int int32_t;
45# elif SIZEOF_LONG == 4
46typedef long int int32_t;
47# endif
48# endif
49
50# ifndef HAVE_UINT32_T
51# if SIZEOF_INT == 4
52typedef unsigned int uint32_t;
53# elif SIZEOF_LONG == 4
54typedef unsigned long int uint32_t;
55# endif
56# endif
57
58#ifdef _WIN32
59# if _MSC_VER >= 1600
60# include <stdint.h>
61# endif
62# ifndef SIZEOF_INT
63# define SIZEOF_INT 4
64# endif
65# ifndef SIZEOF_LONG
66# define SIZEOF_LONG 4
67# endif
68# ifndef int32_t
69typedef __int32 int32_t;
70# endif
71# ifndef uint32_t
72typedef unsigned __int32 uint32_t;
73# endif
74# ifndef int64_t
75typedef __int64 int64_t;
76# endif
77# ifndef uint64_t
78typedef unsigned __int64 uint64_t;
79# endif
80# ifndef PRId32
81# define PRId32 "I32d"
82# endif
83# ifndef PRIu32
84# define PRIu32 "I32u"
85# endif
86# ifndef PRId64
87# define PRId64 "I64d"
88# endif
89# ifndef PRIu64
90# define PRIu64 "I64u"
91# endif
92# ifndef INT32_MAX
93#define INT32_MAX _I32_MAX
94# endif
95# ifndef INT32_MIN
96#define INT32_MIN ((int32_t)_I32_MIN)
97# endif
98# ifndef UINT32_MAX
99#define UINT32_MAX _UI32_MAX
100# endif
101# ifndef INT64_MIN
102#define INT64_MIN ((int64_t)_I64_MIN)
103# endif
104# ifndef INT64_MAX
105#define INT64_MAX _I64_MAX
106# endif
107# ifndef UINT64_MAX
108#define UINT64_MAX _UI64_MAX
109# endif
110#endif
111
112#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
113typedef int64_t timelib_long;
114typedef uint64_t timelib_ulong;
115# define TIMELIB_LONG_MAX INT64_MAX
116# define TIMELIB_LONG_MIN INT64_MIN
117# define TIMELIB_ULONG_MAX UINT64_MAX
118# define TIMELIB_LONG_FMT "%" PRId64
119# define TIMELIB_ULONG_FMT "%" PRIu64
120#else
121typedef int32_t timelib_long;
122typedef uint32_t timelib_ulong;
123# define TIMELIB_LONG_MAX INT32_MAX
124# define TIMELIB_LONG_MIN INT32_MIN
125# define TIMELIB_ULONG_MAX UINT32_MAX
126# define TIMELIB_LONG_FMT "%" PRId32
127# define TIMELIB_ULONG_FMT "%" PRIu32
128#endif
129
130#if defined(_MSC_VER)
131typedef uint64_t timelib_ull;
132typedef int64_t timelib_sll;
133# define TIMELIB_LL_CONST(n) n ## i64
134#else
135typedef unsigned long long timelib_ull;
136typedef signed long long timelib_sll;
137# define TIMELIB_LL_CONST(n) n ## ll
138#endif
139
140typedef struct _ttinfo ttinfo;
141typedef struct _tlinfo tlinfo;
142
143typedef struct _tlocinfo
144{
146 double latitude;
147 double longitude;
148 char *comments;
150
151#define TIMELIB_POSIX_TRANS_TYPE_JULIAN_NO_FEB29 1
152#define TIMELIB_POSIX_TRANS_TYPE_JULIAN_FEB29 2
153#define TIMELIB_POSIX_TRANS_TYPE_MWD 3
154
156{
157 int type; // 1=Jn, 2=n, 3=Mm.w.d
158 union {
159 int days;
160 struct {
161 int month;
162 int week;
163 int dow;
165 };
166 int hour;
168
182
188
189typedef struct _timelib_tzinfo
190{
191 char *name;
192 struct {
193 uint32_t ttisgmtcnt;
194 uint32_t ttisstdcnt;
195 uint32_t leapcnt;
196 uint32_t timecnt;
197 uint32_t typecnt;
198 uint32_t charcnt;
200 struct {
201 uint64_t ttisgmtcnt;
202 uint64_t ttisstdcnt;
203 uint64_t leapcnt;
204 uint64_t timecnt;
205 uint64_t typecnt;
206 uint64_t charcnt;
208
209 int64_t *trans;
210 unsigned char *trans_idx;
211
214
216 unsigned char bc;
218
222
223typedef struct _timelib_rel_time {
224 timelib_sll y, m, d; /* Years, Months and Days */
225 timelib_sll h, i, s; /* Hours, mInutes and Seconds */
226 timelib_sll us; /* Microseconds */
227
228 int weekday; /* Stores the day in 'next monday' */
229 int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
230
232 int invert; /* Whether the difference should be inverted */
233 timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
234
235 struct {
236 unsigned int type;
239
242
250
251typedef struct _timelib_time {
252 timelib_sll y, m, d; /* Year, Month, Day */
253 timelib_sll h, i, s; /* Hour, mInute, Second */
254 timelib_sll us; /* Microseconds */
255 int z; /* UTC offset in seconds */
256 char *tz_abbr; /* Timezone abbreviation (display only) */
257 timelib_tzinfo *tz_info; /* Timezone structure */
258 signed int dst; /* Flag if we were parsing a DST zone */
260
261 timelib_sll sse; /* Seconds since epoch */
262
264
265 unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
266 unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
267 unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
268 unsigned int zone_type; /* 1 time offset,
269 * 3 TimeZone identifier,
270 * 2 TimeZone abbreviation */
272
278
279#define TIMELIB_WARN_MASK 0x1ff
280#define TIMELIB_ERR_MASK 0x2ff
281
282#define TIMELIB_WARN_DOUBLE_TZ 0x101
283#define TIMELIB_WARN_INVALID_TIME 0x102
284#define TIMELIB_WARN_INVALID_DATE 0x103
285#define TIMELIB_WARN_TRAILING_DATA 0x11a
286
287#define TIMELIB_ERR_DOUBLE_TZ 0x201
288#define TIMELIB_ERR_TZID_NOT_FOUND 0x202
289#define TIMELIB_ERR_DOUBLE_TIME 0x203
290#define TIMELIB_ERR_DOUBLE_DATE 0x204
291#define TIMELIB_ERR_UNEXPECTED_CHARACTER 0x205
292#define TIMELIB_ERR_EMPTY_STRING 0x206
293#define TIMELIB_ERR_UNEXPECTED_DATA 0x207
294#define TIMELIB_ERR_NO_TEXTUAL_DAY 0x208
295#define TIMELIB_ERR_NO_TWO_DIGIT_DAY 0x209
296#define TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR 0x20a
297#define TIMELIB_ERR_NO_TWO_DIGIT_MONTH 0x20b
298#define TIMELIB_ERR_NO_TEXTUAL_MONTH 0x20c
299#define TIMELIB_ERR_NO_TWO_DIGIT_YEAR 0x20d
300#define TIMELIB_ERR_NO_FOUR_DIGIT_YEAR 0x20e
301#define TIMELIB_ERR_NO_TWO_DIGIT_HOUR 0x20f
302#define TIMELIB_ERR_HOUR_LARGER_THAN_12 0x210
303#define TIMELIB_ERR_MERIDIAN_BEFORE_HOUR 0x211
304#define TIMELIB_ERR_NO_MERIDIAN 0x212
305#define TIMELIB_ERR_NO_TWO_DIGIT_MINUTE 0x213
306#define TIMELIB_ERR_NO_TWO_DIGIT_SECOND 0x214
307#define TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND 0x215
308#define TIMELIB_ERR_NO_SEP_SYMBOL 0x216
309#define TIMELIB_ERR_EXPECTED_ESCAPE_CHAR 0x217
310#define TIMELIB_ERR_NO_ESCAPED_CHAR 0x218
311#define TIMELIB_ERR_WRONG_FORMAT_SEP 0x219
312#define TIMELIB_ERR_TRAILING_DATA 0x21a
313#define TIMELIB_ERR_DATA_MISSING 0x21b
314#define TIMELIB_ERR_NO_THREE_DIGIT_MILLISECOND 0x21c
315#define TIMELIB_ERR_NO_FOUR_DIGIT_YEAR_ISO 0x21d
316#define TIMELIB_ERR_NO_TWO_DIGIT_WEEK 0x21e
317#define TIMELIB_ERR_INVALID_WEEK 0x21f
318#define TIMELIB_ERR_NO_DAY_OF_WEEK 0x220
319#define TIMELIB_ERR_INVALID_DAY_OF_WEEK 0x221
320#define TIMELIB_ERR_INVALID_SPECIFIER 0x222
321#define TIMELIB_ERR_INVALID_TZ_OFFSET 0x223
322#define TIMELIB_ERR_FORMAT_LITERAL_MISMATCH 0x224
323#define TIMELIB_ERR_MIX_ISO_WITH_NATURAL 0x225
324#define TIMELIB_ERR_NUMBER_OUT_OF_RANGE 0x226
325
326#define TIMELIB_ZONETYPE_NONE 0
327#define TIMELIB_ZONETYPE_OFFSET 1
328#define TIMELIB_ZONETYPE_ABBR 2
329#define TIMELIB_ZONETYPE_ID 3
330
337
344
351
356
357typedef struct _timelib_tzdb {
358 const char *version;
361 const unsigned char *data;
363
364#ifndef timelib_malloc
365# define timelib_malloc malloc
366# define timelib_realloc realloc
367# define timelib_calloc calloc
368# define timelib_strdup strdup
369# define timelib_free free
370# if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
371# define TIMELIB_USE_BUILTIN_STRNDUP 1
372# else
373# define TIMELIB_USE_BUILTIN_STRNDUP 0
374# define timelib_strndup strndup
375# endif
376#endif
377
378#define TIMELIB_NONE 0x00
379#define TIMELIB_OVERRIDE_TIME 0x01
380#define TIMELIB_NO_CLONE 0x02
381
382#define TIMELIB_UNSET -9999999
383
384/* An entry for each of these error codes is also in the
385 * timelib_error_messages array in timelib.c.
386 * Codes 0x00, 0x07, and 0x09 are warnings only. */
387#define TIMELIB_ERROR_NO_ERROR 0x00
388#define TIMELIB_ERROR_CANNOT_ALLOCATE 0x01
389#define TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE 0x02
390#define TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE 0x03
391#define TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION 0x04
392#define TIMELIB_ERROR_UNSUPPORTED_VERSION 0x05
393#define TIMELIB_ERROR_NO_SUCH_TIMEZONE 0x06
394#define TIMELIB_ERROR_SLIM_FILE 0x07 /* Warns if the file is SLIM, but we can't read it */
395#define TIMELIB_ERROR_CORRUPT_POSIX_STRING 0x08
396#define TIMELIB_ERROR_EMPTY_POSIX_STRING 0x09 /* Warns if the POSIX string is empty, but still produces results */
397
398#ifdef __cplusplus
399extern "C" {
400#endif
401
445
450
453 /* Format speciifiers must be preceded by 'prefix_char' if not '\0'. */
456
457/* Function pointers */
458typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(const char *tzname, const timelib_tzdb *tzdb, int *error_code);
459
460/* From dow.c */
461/* Calculates the day of the week from y, m, and d. 0=Sunday..6=Saturday */
463
464/* Calculates the day of the ISO week from y, m, and d. 1=Monday, 7=Sunday */
466
467/* Calculates the day of the year according to y-m-d. 0=Jan 1st..364/365=Dec
468 * 31st */
470
471/* Calculates the day of the year according to y-w-dow. 0..364/365 */
473
474/* Calculates the number of days in month m for year y. 28..31 */
476
477/* Calculates the ISO year and week from y, m, and d, into iw and iy */
479
480/* Calculates the ISO year, week, and day of week from y, m, and d, into iy,
481 * iw, and id */
483
484/* Calculates the year, month, and day from iy, iw, and iw, into y, m, and d */
486
487/* Returns true if h, i and s fit in the range 00:00:00..23:59:59, false
488 * otherwise */
490
491/* Returns true if m fits in the range 1..12, and d fits in the range
492 * 1..<days-in-month> for year y */
494
495/* From parse_date.re */
496
497/* Parses the date/time string in 's' with length 'len' into the constituent
498 * parts of timelib_time*.
499 *
500 * Depending on the contents of the string 's', not all elements might be
501 * filled. You can check whether a specific element has been parsed by
502 * comparing with the TIMELIB_UNSET define.
503 *
504 * If errors occur, this function keeps already parsed elements in the
505 * returned timelib_time* value.
506 *
507 * If the **errors points to a timelib_error_container variable, warnings
508 * and errors will be recorded. You are responsible for freeing the stored
509 * information with timelib_error_container_dtor(). To see whether errors have
510 * occurred, inspect errors->errors_count. To see whether warnings have occurred,
511 * inspect errors->warnings_count.
512 *
513 * The returned timelib_time* value is dynamically allocated and should be
514 * freed with timelib_time_dtor().
515 */
516timelib_time *timelib_strtotime(const char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
517
518/* Parses the date/time string in 's' with length 'len' into the constituent
519 * parts of timelib_time* according to the format in 'format'.
520 *
521 * Depending on the contents of the string 's', not all elements might be
522 * filled. You can check whether a specific element has been parsed by
523 * comparing with the TIMELIB_UNSET define.
524 *
525 * If errors occur, this function keeps already parsed elements in the
526 * returned timelib_time* value.
527 *
528 * If the **errors points to a timelib_error_container variable, warnings
529 * and errors will be recorded. You are responsible for freeing the stored
530 * information with timelib_error_container_dtor(). To see whether errors have
531 * occurred, inspect errors->errors_count. To see whether warnings have occurred,
532 * inspect errors->warnings_count.
533 *
534 * The returned timelib_time* value is dynamically allocated and should be
535 * freed with timelib_time_dtor().
536 */
537timelib_time *timelib_parse_from_format(const char *format, const char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
538
539/* Parses the date/time string in 's' with length 'len' into the constituent
540 * parts of timelib_time* according to the format in 'format' with format
541 * specifier configuration 'format_config'.
542 *
543 * 'format_map' is an array of pairs, with the first element being the format
544 * specifier as a character and the second element corresponds to the
545 * representation of the specifier from the enum list
546 * 'timelib_format_specifier_code'.
547 *
548 * Note: 'format_map' must be terminated with specifier '\0' to indicate to the
549 * parser that there are no more format specifiers in the list.
550 */
551timelib_time *timelib_parse_from_format_with_map(const char *format, const char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper, const timelib_format_config* format_config);
552
553/* Fills the gaps in the parsed timelib_time with information from the reference date/time in 'now'
554 *
555 * If any of the 'parsed' y, m, d, h, i or s parameters is unset (TIMELIB_UNSET):
556 * - if microtime (us) is unset, then the us of the parsed time is set to 0.
557 * - else if microtime (us) is unset and 'now'->'us' is set, use it, otherwise use 0.
558 *
559 * For either of the 'parsed' y, m, d, h, i, s, z (utc offset in seconds) or
560 * dst is unset, set it to the corresponding value in 'now' if set, otherwise
561 * set it to 0.
562 *
563 * It duplicates tz_abbr if unset in 'parsed' but set in 'now'.
564 *
565 * It duplicates tz_info if unset in 'parsed', but set in 'now' unless
566 * TIMELIB_NO_CLONE is passed, in which case only the pointer in 'parsed' is
567 * set to 'now'.
568 *
569 * If the option TIMELIB_OVERRIDE_TIME is passed and the parsed date/time has
570 * no time portion, the function will ignore the time aspect in 'now' and
571 * instead fill it with zeros.
572 */
574
575/* Tries to convert a time zone abbreviation, gmtoffset and/or isdst flag
576 * combination to a time zone identifier.
577 *
578 * If 'abbr' is either 'utc' or 'gmt' (case insensitve) then "UTC" is
579 * returned.
580 *
581 * It first uses the data in the timezonemap.h file to find a matching
582 * abbreviation/GMT offset combination. If not found, it uses the data in
583 * fallbackmap.h to match only the GMT offset/isdst flag to try to find a
584 * match. If nothing is found, NULL is returned.
585 *
586 * The returned char* is not duplicated, and should not be freed.
587 */
588const char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
589
590/* Returns an array of known time zone abbreviations
591 *
592 * This file is generated from the time zone database through the
593 * gettzmapping.php scripts, which requires that an up-to-date time zone
594 * database is used with the PHP binary that runs the script.
595 *
596 * Each item in the returned list contains the abbreviation, a flag whether
597 * it's an abbreviation used with DST, the UTC offset in seconds, and the name
598 * of the time zone identifier that this abbreviation belongs to.
599 *
600 * The order for each specific abbreviation is controlled through the
601 * preference list in the gettzmapping.php script. Time zones that match the
602 * pattern ±\d{2,4} are excluded
603 */
605
609timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
610
611/* From parse_iso_intervals.re */
612
623void timelib_strtointerval(const char *s, size_t len,
625 timelib_rel_time **period, int *recurrences,
626 timelib_error_container **errors);
627
628
629/* From tm2unixtime.c */
630
644
650
659
670
671/* From unixtime2tm.c */
672
680
686
692
698
705
714
729
730/* From parse_tz.c */
731
736int timelib_timezone_id_is_valid(const char *timezone, const timelib_tzdb *tzdb);
737
766
771
778
786
796
808int timelib_get_time_zone_offset_info(timelib_sll ts, timelib_tzinfo *tz, int32_t* offset, timelib_sll* transition_time, unsigned int* is_dst);
809
816
826
831
838
848
849/* From parse_zoneinfo.c */
850
860timelib_tzdb *timelib_zoneinfo(const char *directory);
861
869
870/* From timelib.c */
871
877
884
889
897
904
909
917
928
935
940
946
963
972
978
982void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
983
987void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h);
988
992void timelib_hmsf_to_decimal_hour(int hour, int min, int sec, int us, double *h);
993
998
999
1000/* from astro.c */
1001
1010
1018
1046int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit);
1047
1048/* from interval.c */
1049
1059
1068
1077
1087
1088/* from parse_posix.c */
1089
1091
1092timelib_posix_str* timelib_parse_posix_str(const char *posix);
1093
1098
1099
1100#ifdef __cplusplus
1101} /* extern "C" */
1102#endif
1103
1104#endif
size_t len
Definition apprentice.c:174
count(Countable|array $value, int $mode=COUNT_NORMAL)
char s[4]
Definition cdf.c:77
int begin
Definition eaw_table.h:20
error($message)
Definition ext_skel.php:22
void * ptr
Definition ffi.c:3814
zend_long offset
time()
unsigned const char * end
Definition php_ffi.h:51
#define t1
#define t2
PHP_JSON_API size_t int options
Definition php_json.h:102
php_json_error_code error_code
Definition php_json.h:92
#define min(a, b)
time_t now
Definition session.c:1281
timelib_sll utc_offset
Definition timelib.h:274
timelib_error_message * error_messages
Definition timelib.h:339
timelib_error_message * warning_messages
Definition timelib.h:340
const timelib_format_specifier * format_map
Definition timelib.h:452
timelib_format_specifier_code code
Definition timelib.h:448
timelib_posix_trans_info * dst_begin
Definition timelib.h:176
timelib_sll dst_offset
Definition timelib.h:174
timelib_posix_trans_info * dst_end
Definition timelib.h:177
timelib_sll std_offset
Definition timelib.h:172
struct _timelib_posix_trans_info::@345311100176353124100366323371063073143026264113::@040362207207357206375134264261113207025001271156 mwd
timelib_sll types[6]
Definition timelib.h:186
timelib_sll times[6]
Definition timelib.h:185
timelib_sll h
Definition timelib.h:225
timelib_sll days
Definition timelib.h:233
struct _timelib_rel_time::@101250100307152364107271232245320174113050270325 special
timelib_sll d
Definition timelib.h:224
timelib_sll us
Definition timelib.h:226
timelib_sll i
Definition timelib.h:225
timelib_sll amount
Definition timelib.h:237
unsigned int type
Definition timelib.h:236
unsigned int have_special_relative
Definition timelib.h:240
timelib_sll y
Definition timelib.h:224
unsigned int have_weekday_relative
Definition timelib.h:240
timelib_sll s
Definition timelib.h:225
timelib_sll m
Definition timelib.h:224
timelib_sll transition_time
Definition timelib.h:248
unsigned int is_dst
Definition timelib.h:246
unsigned int leap_secs
Definition timelib.h:245
unsigned int is_localtime
Definition timelib.h:267
timelib_sll s
Definition timelib.h:253
timelib_sll h
Definition timelib.h:253
timelib_sll d
Definition timelib.h:252
timelib_sll sse
Definition timelib.h:261
unsigned int tim_uptodate
Definition timelib.h:266
char * tz_abbr
Definition timelib.h:256
timelib_sll m
Definition timelib.h:252
unsigned int have_time
Definition timelib.h:263
unsigned int zone_type
Definition timelib.h:268
signed int dst
Definition timelib.h:258
timelib_tzinfo * tz_info
Definition timelib.h:257
unsigned int have_zone
Definition timelib.h:263
unsigned int have_weeknr_day
Definition timelib.h:263
timelib_sll y
Definition timelib.h:252
unsigned int sse_uptodate
Definition timelib.h:265
unsigned int have_date
Definition timelib.h:263
timelib_sll us
Definition timelib.h:254
timelib_sll i
Definition timelib.h:253
unsigned int have_relative
Definition timelib.h:263
timelib_rel_time relative
Definition timelib.h:259
const char * full_tz_name
Definition timelib.h:349
Definition timelib.h:352
char * id
Definition timelib.h:353
unsigned int pos
Definition timelib.h:354
const char * version
Definition timelib.h:358
const timelib_tzdb_index_entry * index
Definition timelib.h:360
const unsigned char * data
Definition timelib.h:361
struct _timelib_tzinfo::@164363312306351063307143032200107146325273170202 bit64
struct _timelib_tzinfo::@167337112217316310035373242356361101315007242016 _bit32
uint32_t timecnt
Definition timelib.h:196
uint32_t typecnt
Definition timelib.h:197
uint32_t charcnt
Definition timelib.h:198
ttinfo * type
Definition timelib.h:212
uint32_t ttisstdcnt
Definition timelib.h:194
tlocinfo location
Definition timelib.h:217
uint32_t leapcnt
Definition timelib.h:195
uint32_t ttisgmtcnt
Definition timelib.h:193
unsigned char bc
Definition timelib.h:216
timelib_posix_str * posix_info
Definition timelib.h:220
char * timezone_abbr
Definition timelib.h:213
int64_t * trans
Definition timelib.h:209
unsigned char * trans_idx
Definition timelib.h:210
tlinfo * leap_times
Definition timelib.h:215
char * posix_string
Definition timelib.h:219
double longitude
Definition timelib.h:147
char country_code[3]
Definition timelib.h:145
char * comments
Definition timelib.h:148
double latitude
Definition timelib.h:146
void timelib_time_offset_dtor(timelib_time_offset *t)
Definition timelib.c:141
timelib_time * timelib_add(timelib_time *t, timelib_rel_time *interval)
Definition interval.c:211
timelib_time * timelib_sub_wall(timelib_time *t, timelib_rel_time *interval)
Definition interval.c:338
timelib_time * timelib_parse_from_format(const char *format, const char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
const timelib_tzdb_index_entry * timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count)
Definition parse_tz.c:611
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d)
Definition dow.c:160
timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
Definition parse_date.c:940
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
Definition timelib.c:188
struct _tlinfo tlinfo
Definition timelib.h:141
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id)
Definition dow.c:141
timelib_time * timelib_time_ctor(void)
Definition timelib.c:61
void timelib_unixtime2gmt(timelib_time *tm, timelib_sll ts)
Definition unixtime2tm.c:57
timelib_tzdb * timelib_zoneinfo(const char *directory)
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
const timelib_tz_lookup_table * timelib_timezone_abbreviations_list(void)
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
Definition dow.c:72
timelib_long timelib_date_to_int(timelib_time *d, int *error)
Definition timelib.c:170
timelib_time * timelib_time_clone(timelib_time *orig)
Definition timelib.c:88
const char * timelib_get_error_message(int error_code)
Definition timelib.c:51
void timelib_hmsf_to_decimal_hour(int hour, int min, int sec, int us, double *h)
Definition timelib.c:218
int timelib_same_timezone(timelib_time *one, timelib_time *two)
Definition parse_tz.c:955
unsigned long long timelib_ull
Definition timelib.h:135
timelib_time * timelib_strtotime(const char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
struct _timelib_error_container timelib_error_container
int timelib_time_compare(timelib_time *t1, timelib_time *t2)
Definition timelib.c:75
void timelib_posix_str_dtor(timelib_posix_str *ps)
timelib_tzinfo * timelib_tzinfo_clone(timelib_tzinfo *tz)
Definition parse_tz.c:745
void timelib_dump_tzinfo(timelib_tzinfo *tz)
Definition parse_tz.c:510
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy)
Definition dow.c:93
struct _tlocinfo tlocinfo
enum _timelib_format_specifier_code timelib_format_specifier_code
void timelib_unixtime2date(timelib_sll ts, timelib_sll *y, timelib_sll *m, timelib_sll *d)
Definition unixtime2tm.c:29
void timelib_update_ts(timelib_time *time, timelib_tzinfo *tzi)
void timelib_update_from_sse(timelib_time *tm)
Definition unixtime2tm.c:83
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
Definition parse_tz.c:728
timelib_time * timelib_add_wall(timelib_time *t, timelib_rel_time *interval)
Definition interval.c:284
struct _timelib_tzdb timelib_tzdb
struct _timelib_format_config timelib_format_config
void timelib_dump_rel_time(timelib_rel_time *d)
Definition timelib.c:376
timelib_tzinfo * timelib_parse_tzfile(const char *timezone, const timelib_tzdb *tzdb, int *error_code)
Definition parse_tz.c:662
timelib_rel_time * timelib_diff(timelib_time *one, timelib_time *two)
Definition interval.c:146
int timelib_diff_days(timelib_time *one, timelib_time *two)
Definition interval.c:181
struct _timelib_error_message timelib_error_message
void timelib_zoneinfo_dtor(timelib_tzdb *tzdb)
timelib_tzinfo *(* timelib_tz_get_wrapper)(const char *tzname, const timelib_tzdb *tzdb, int *error_code)
Definition timelib.h:458
timelib_time_offset * timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz)
Definition parse_tz.c:881
timelib_sll timelib_get_current_offset(timelib_time *t)
Definition parse_tz.c:937
timelib_time * timelib_parse_from_format_with_map(const char *format, const char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper, const timelib_format_config *format_config)
void timelib_error_container_dtor(timelib_error_container *errors)
Definition timelib.c:155
int32_t timelib_long
Definition timelib.h:121
struct _timelib_time timelib_time
timelib_time * timelib_sub(timelib_time *t, timelib_rel_time *interval)
Definition interval.c:242
void timelib_dump_date(timelib_time *d, int options)
Definition timelib.c:305
int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit)
Definition astro.c:212
timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d)
Definition dow.c:83
int timelib_timezone_id_is_valid(const char *timezone, const timelib_tzdb *tzdb)
Definition parse_tz.c:617
void timelib_strtointerval(const char *s, size_t len, timelib_time **begin, timelib_time **end, timelib_rel_time **period, int *recurrences, timelib_error_container **errors)
struct _timelib_posix_str timelib_posix_str
int timelib_get_time_zone_offset_info(timelib_sll ts, timelib_tzinfo *tz, int32_t *offset, timelib_sll *transition_time, unsigned int *is_dst)
Definition parse_tz.c:913
uint32_t timelib_ulong
Definition timelib.h:122
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
Definition dow.c:67
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
void timelib_time_dtor(timelib_time *t)
Definition timelib.c:69
struct _timelib_format_specifier timelib_format_specifier
const timelib_tzdb * timelib_builtin_db(void)
Definition parse_tz.c:606
timelib_time_offset * timelib_time_offset_ctor(void)
Definition timelib.c:133
double timelib_ts_to_j2000(timelib_sll ts)
Definition astro.c:310
void timelib_rel_time_dtor(timelib_rel_time *t)
Definition timelib.c:109
timelib_sll timelib_hms_to_seconds(timelib_sll h, timelib_sll m, timelib_sll s)
Definition timelib.c:227
struct _timelib_rel_time timelib_rel_time
struct _timelib_tzdb_index_entry timelib_tzdb_index_entry
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
const char * timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
timelib_sll timelib_epoch_days_from_time(timelib_time *time)
timelib_posix_str * timelib_parse_posix_str(const char *posix)
_timelib_format_specifier_code
Definition timelib.h:402
@ TIMELIB_FORMAT_LITERAL
Definition timelib.h:418
@ TIMELIB_FORMAT_TEXTUAL_DAY_3_LETTER
Definition timelib.h:431
@ TIMELIB_FORMAT_SEPARATOR
Definition timelib.h:429
@ TIMELIB_FORMAT_ESCAPE
Definition timelib.h:413
@ TIMELIB_FORMAT_SKIP_TO_SEPARATOR
Definition timelib.h:430
@ TIMELIB_FORMAT_WEEK_OF_YEAR_ISO
Definition timelib.h:437
@ TIMELIB_FORMAT_TEXTUAL_MONTH_3_LETTER
Definition timelib.h:433
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_24_MAX
Definition timelib.h:416
@ TIMELIB_FORMAT_TIMEZONE_OFFSET
Definition timelib.h:435
@ TIMELIB_FORMAT_EPOCH_SECONDS
Definition timelib.h:412
@ TIMELIB_FORMAT_DAY_SUFFIX
Definition timelib.h:410
@ TIMELIB_FORMAT_ALLOW_EXTRA_CHARACTERS
Definition timelib.h:403
@ TIMELIB_FORMAT_WHITESPACE
Definition timelib.h:439
@ TIMELIB_FORMAT_YEAR_EXPANDED
Definition timelib.h:442
@ TIMELIB_FORMAT_ANY_SEPARATOR
Definition timelib.h:404
@ TIMELIB_FORMAT_MINUTE_TWO_DIGIT
Definition timelib.h:422
@ TIMELIB_FORMAT_SECOND_TWO_DIGIT
Definition timelib.h:428
@ TIMELIB_FORMAT_TIMEZONE_OFFSET_MINUTES
Definition timelib.h:436
@ TIMELIB_FORMAT_END
Definition timelib.h:411
@ TIMELIB_FORMAT_TEXTUAL_MONTH_FULL
Definition timelib.h:434
@ TIMELIB_FORMAT_YEAR_FOUR_DIGIT
Definition timelib.h:441
@ TIMELIB_FORMAT_DAY_OF_WEEK_ISO
Definition timelib.h:407
@ TIMELIB_FORMAT_RANDOM_CHAR
Definition timelib.h:425
@ TIMELIB_FORMAT_MILLISECOND_THREE_DIGIT
Definition timelib.h:421
@ TIMELIB_FORMAT_DAY_OF_YEAR
Definition timelib.h:409
@ TIMELIB_FORMAT_TEXTUAL_DAY_FULL
Definition timelib.h:432
@ TIMELIB_FORMAT_MONTH_TWO_DIGIT_PADDED
Definition timelib.h:424
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_24_MAX_PADDED
Definition timelib.h:417
@ TIMELIB_FORMAT_YEAR_ISO
Definition timelib.h:443
@ TIMELIB_FORMAT_WEEK_OF_YEAR
Definition timelib.h:438
@ TIMELIB_FORMAT_DAY_TWO_DIGIT
Definition timelib.h:405
@ TIMELIB_FORMAT_DAY_OF_WEEK
Definition timelib.h:408
@ TIMELIB_FORMAT_MONTH_TWO_DIGIT
Definition timelib.h:423
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_12_MAX_PADDED
Definition timelib.h:415
@ TIMELIB_FORMAT_MICROSECOND_SIX_DIGIT
Definition timelib.h:420
@ TIMELIB_FORMAT_RESET_ALL_WHEN_NOT_SET
Definition timelib.h:427
@ TIMELIB_FORMAT_YEAR_TWO_DIGIT
Definition timelib.h:440
@ TIMELIB_FORMAT_RESET_ALL
Definition timelib.h:426
@ TIMELIB_FORMAT_MERIDIAN
Definition timelib.h:419
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_12_MAX
Definition timelib.h:414
@ TIMELIB_FORMAT_DAY_TWO_DIGIT_PADDED
Definition timelib.h:406
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d)
Definition dow.c:203
struct _ttinfo ttinfo
Definition timelib.h:140
timelib_rel_time * timelib_rel_time_ctor(void)
Definition timelib.c:101
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m)
Definition dow.c:88
struct _timelib_posix_trans_info timelib_posix_trans_info
signed long long timelib_sll
Definition timelib.h:136
struct _timelib_time_offset timelib_time_offset
struct _timelib_tzinfo timelib_tzinfo
struct _timelib_tz_lookup_table timelib_tz_lookup_table
struct _timelib_abbr_info timelib_abbr_info
void timelib_do_normalize(timelib_time *base)
struct _timelib_posix_transitions timelib_posix_transitions
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info)
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id)
Definition dow.c:147
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz)
Definition parse_tz.c:870
timelib_rel_time * timelib_rel_time_clone(timelib_rel_time *tz)
Definition timelib.c:114
void timelib_get_transitions_for_year(timelib_tzinfo *tz, timelib_sll year, timelib_posix_transitions *transitions)
int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
Definition dow.c:195
double timelib_ts_to_julianday(timelib_sll ts)
Definition astro.c:299
void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h)
Definition timelib.c:209
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)