29#ifdef HAVE_TIMELIB_CONFIG_H
30# include "timelib_config.h"
33#define TIMELIB_VERSION 202212
34#define TIMELIB_EXTENDED_VERSION 20221201
35#define TIMELIB_ASCII_VERSION "2022.12"
45# elif SIZEOF_LONG == 4
46typedef long int int32_t;
52typedef unsigned int uint32_t;
53# elif SIZEOF_LONG == 4
54typedef unsigned long int uint32_t;
69typedef __int32 int32_t;
72typedef unsigned __int32 uint32_t;
75typedef __int64 int64_t;
78typedef unsigned __int64 uint64_t;
93#define INT32_MAX _I32_MAX
96#define INT32_MIN ((int32_t)_I32_MIN)
99#define UINT32_MAX _UI32_MAX
102#define INT64_MIN ((int64_t)_I64_MIN)
105#define INT64_MAX _I64_MAX
108#define UINT64_MAX _UI64_MAX
112#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
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
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
133# define TIMELIB_LL_CONST(n) n ## i64
137# define TIMELIB_LL_CONST(n) n ## ll
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
279#define TIMELIB_WARN_MASK 0x1ff
280#define TIMELIB_ERR_MASK 0x2ff
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
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
326#define TIMELIB_ZONETYPE_NONE 0
327#define TIMELIB_ZONETYPE_OFFSET 1
328#define TIMELIB_ZONETYPE_ABBR 2
329#define TIMELIB_ZONETYPE_ID 3
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
373# define TIMELIB_USE_BUILTIN_STRNDUP 0
374# define timelib_strndup strndup
378#define TIMELIB_NONE 0x00
379#define TIMELIB_OVERRIDE_TIME 0x01
380#define TIMELIB_NO_CLONE 0x02
382#define TIMELIB_UNSET -9999999
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
395#define TIMELIB_ERROR_CORRUPT_POSIX_STRING 0x08
396#define TIMELIB_ERROR_EMPTY_POSIX_STRING 0x09
count(Countable|array $value, int $mode=COUNT_NORMAL)
unsigned const char * end
PHP_JSON_API size_t int options
php_json_error_code error_code
timelib_error_message * error_messages
timelib_error_message * warning_messages
timelib_posix_trans_info * dst_begin
timelib_posix_trans_info * dst_end
struct _timelib_posix_trans_info::@345311100176353124100366323371063073143026264113::@040362207207357206375134264261113207025001271156 mwd
struct _timelib_rel_time::@101250100307152364107271232245320174113050270325 special
unsigned int have_special_relative
unsigned int have_weekday_relative
timelib_sll transition_time
unsigned int is_localtime
unsigned int tim_uptodate
unsigned int have_weeknr_day
unsigned int sse_uptodate
unsigned int have_relative
timelib_rel_time relative
const char * full_tz_name
const timelib_tzdb_index_entry * index
const unsigned char * data
struct _timelib_tzinfo::@164363312306351063307143032200107146325273170202 bit64
struct _timelib_tzinfo::@167337112217316310035373242356361101315007242016 _bit32
timelib_posix_str * posix_info
unsigned char * trans_idx
void timelib_time_offset_dtor(timelib_time_offset *t)
timelib_time * timelib_add(timelib_time *t, timelib_rel_time *interval)
timelib_time * timelib_sub_wall(timelib_time *t, timelib_rel_time *interval)
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)
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d)
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)
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id)
timelib_time * timelib_time_ctor(void)
void timelib_unixtime2gmt(timelib_time *tm, timelib_sll ts)
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)
timelib_long timelib_date_to_int(timelib_time *d, int *error)
timelib_time * timelib_time_clone(timelib_time *orig)
const char * timelib_get_error_message(int error_code)
void timelib_hmsf_to_decimal_hour(int hour, int min, int sec, int us, double *h)
int timelib_same_timezone(timelib_time *one, timelib_time *two)
unsigned long long timelib_ull
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)
void timelib_posix_str_dtor(timelib_posix_str *ps)
timelib_tzinfo * timelib_tzinfo_clone(timelib_tzinfo *tz)
void timelib_dump_tzinfo(timelib_tzinfo *tz)
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy)
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)
void timelib_update_ts(timelib_time *time, timelib_tzinfo *tzi)
void timelib_update_from_sse(timelib_time *tm)
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
timelib_time * timelib_add_wall(timelib_time *t, timelib_rel_time *interval)
struct _timelib_tzdb timelib_tzdb
struct _timelib_format_config timelib_format_config
void timelib_dump_rel_time(timelib_rel_time *d)
timelib_tzinfo * timelib_parse_tzfile(const char *timezone, const timelib_tzdb *tzdb, int *error_code)
timelib_rel_time * timelib_diff(timelib_time *one, timelib_time *two)
int timelib_diff_days(timelib_time *one, timelib_time *two)
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)
timelib_time_offset * timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz)
timelib_sll timelib_get_current_offset(timelib_time *t)
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)
struct _timelib_time timelib_time
timelib_time * timelib_sub(timelib_time *t, timelib_rel_time *interval)
void timelib_dump_date(timelib_time *d, int options)
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)
timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d)
int timelib_timezone_id_is_valid(const char *timezone, const timelib_tzdb *tzdb)
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)
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
void timelib_time_dtor(timelib_time *t)
struct _timelib_format_specifier timelib_format_specifier
const timelib_tzdb * timelib_builtin_db(void)
timelib_time_offset * timelib_time_offset_ctor(void)
double timelib_ts_to_j2000(timelib_sll ts)
void timelib_rel_time_dtor(timelib_rel_time *t)
timelib_sll timelib_hms_to_seconds(timelib_sll h, timelib_sll m, timelib_sll s)
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
@ TIMELIB_FORMAT_TEXTUAL_DAY_3_LETTER
@ TIMELIB_FORMAT_SEPARATOR
@ TIMELIB_FORMAT_SKIP_TO_SEPARATOR
@ TIMELIB_FORMAT_WEEK_OF_YEAR_ISO
@ TIMELIB_FORMAT_TEXTUAL_MONTH_3_LETTER
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_24_MAX
@ TIMELIB_FORMAT_TIMEZONE_OFFSET
@ TIMELIB_FORMAT_EPOCH_SECONDS
@ TIMELIB_FORMAT_DAY_SUFFIX
@ TIMELIB_FORMAT_ALLOW_EXTRA_CHARACTERS
@ TIMELIB_FORMAT_WHITESPACE
@ TIMELIB_FORMAT_YEAR_EXPANDED
@ TIMELIB_FORMAT_ANY_SEPARATOR
@ TIMELIB_FORMAT_MINUTE_TWO_DIGIT
@ TIMELIB_FORMAT_SECOND_TWO_DIGIT
@ TIMELIB_FORMAT_TIMEZONE_OFFSET_MINUTES
@ TIMELIB_FORMAT_TEXTUAL_MONTH_FULL
@ TIMELIB_FORMAT_YEAR_FOUR_DIGIT
@ TIMELIB_FORMAT_DAY_OF_WEEK_ISO
@ TIMELIB_FORMAT_RANDOM_CHAR
@ TIMELIB_FORMAT_MILLISECOND_THREE_DIGIT
@ TIMELIB_FORMAT_DAY_OF_YEAR
@ TIMELIB_FORMAT_TEXTUAL_DAY_FULL
@ TIMELIB_FORMAT_MONTH_TWO_DIGIT_PADDED
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_24_MAX_PADDED
@ TIMELIB_FORMAT_YEAR_ISO
@ TIMELIB_FORMAT_WEEK_OF_YEAR
@ TIMELIB_FORMAT_DAY_TWO_DIGIT
@ TIMELIB_FORMAT_DAY_OF_WEEK
@ TIMELIB_FORMAT_MONTH_TWO_DIGIT
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_12_MAX_PADDED
@ TIMELIB_FORMAT_MICROSECOND_SIX_DIGIT
@ TIMELIB_FORMAT_RESET_ALL_WHEN_NOT_SET
@ TIMELIB_FORMAT_YEAR_TWO_DIGIT
@ TIMELIB_FORMAT_RESET_ALL
@ TIMELIB_FORMAT_MERIDIAN
@ TIMELIB_FORMAT_HOUR_TWO_DIGIT_12_MAX
@ TIMELIB_FORMAT_DAY_TWO_DIGIT_PADDED
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d)
timelib_rel_time * timelib_rel_time_ctor(void)
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m)
struct _timelib_posix_trans_info timelib_posix_trans_info
signed long long timelib_sll
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)
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz)
timelib_rel_time * timelib_rel_time_clone(timelib_rel_time *tz)
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)
double timelib_ts_to_julianday(timelib_sll ts)
void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h)
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)