summaryrefslogtreecommitdiff
path: root/src/third_party
diff options
context:
space:
mode:
authorDerick Rethans <github@derickrethans.nl>2017-07-27 13:03:58 +0100
committerDerick Rethans <github@derickrethans.nl>2017-08-01 09:51:12 +0100
commit7cad8ba246755794c31b237531fedb09c0baa534 (patch)
treecf944213d61470ecc61f9e14c6b20c1c2d321f0c /src/third_party
parent835bfb21d8e67663d84a40aa4f7370a4403725a9 (diff)
downloadmongo-7cad8ba246755794c31b237531fedb09c0baa534.tar.gz
SERVER-30259 Change calculations in timelib to use seconds East instead of minutes West
Diffstat (limited to 'src/third_party')
-rw-r--r--src/third_party/SConscript2
-rwxr-xr-xsrc/third_party/scripts/timelib_get_sources.sh2
-rw-r--r--src/third_party/timelib-2017.05beta5/fallbackmap.h42
-rw-r--r--src/third_party/timelib-2017.05beta5/timelib.h444
-rw-r--r--src/third_party/timelib-2017.05beta6/LICENSE.rst (renamed from src/third_party/timelib-2017.05beta5/LICENSE.rst)0
-rw-r--r--src/third_party/timelib-2017.05beta6/Makefile (renamed from src/third_party/timelib-2017.05beta5/Makefile)22
-rw-r--r--src/third_party/timelib-2017.05beta6/README.rst (renamed from src/third_party/timelib-2017.05beta5/README.rst)0
-rw-r--r--src/third_party/timelib-2017.05beta6/SConscript (renamed from src/third_party/timelib-2017.05beta5/SConscript)0
-rw-r--r--src/third_party/timelib-2017.05beta6/astro.c (renamed from src/third_party/timelib-2017.05beta5/astro.c)8
-rw-r--r--src/third_party/timelib-2017.05beta6/astro.h (renamed from src/third_party/timelib-2017.05beta5/astro.h)0
-rw-r--r--src/third_party/timelib-2017.05beta6/docs/date-from-iso-parts.c (renamed from src/third_party/timelib-2017.05beta5/docs/date-from-iso-parts.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/docs/date-from-parts.c (renamed from src/third_party/timelib-2017.05beta5/docs/date-from-parts.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/docs/date-from-string.c (renamed from src/third_party/timelib-2017.05beta5/docs/date-from-string.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/docs/date-to-parts.c (renamed from src/third_party/timelib-2017.05beta5/docs/date-to-parts.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/dow.c (renamed from src/third_party/timelib-2017.05beta5/dow.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/fallbackmap.h42
-rw-r--r--src/third_party/timelib-2017.05beta6/gettzmapping.php (renamed from src/third_party/timelib-2017.05beta5/gettzmapping.php)3
-rw-r--r--src/third_party/timelib-2017.05beta6/interval.c (renamed from src/third_party/timelib-2017.05beta5/interval.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/parse_date.c (renamed from src/third_party/timelib-2017.05beta5/parse_date.c)260
-rw-r--r--src/third_party/timelib-2017.05beta6/parse_date.re (renamed from src/third_party/timelib-2017.05beta5/parse_date.re)60
-rw-r--r--src/third_party/timelib-2017.05beta6/parse_iso_intervals.c (renamed from src/third_party/timelib-2017.05beta5/parse_iso_intervals.c)45
-rw-r--r--src/third_party/timelib-2017.05beta6/parse_iso_intervals.re (renamed from src/third_party/timelib-2017.05beta5/parse_iso_intervals.re)9
-rw-r--r--src/third_party/timelib-2017.05beta6/parse_tz.c (renamed from src/third_party/timelib-2017.05beta5/parse_tz.c)71
-rw-r--r--src/third_party/timelib-2017.05beta6/parse_zoneinfo.c (renamed from src/third_party/timelib-2017.05beta5/parse_zoneinfo.c)0
-rw-r--r--src/third_party/timelib-2017.05beta6/timelib.c (renamed from src/third_party/timelib-2017.05beta5/timelib.c)161
-rw-r--r--src/third_party/timelib-2017.05beta6/timelib.h871
-rw-r--r--src/third_party/timelib-2017.05beta6/timelib.m4 (renamed from src/third_party/timelib-2017.05beta5/timelib.m4)0
-rw-r--r--src/third_party/timelib-2017.05beta6/timelib_private.h (renamed from src/third_party/timelib-2017.05beta5/timelib_private.h)23
-rw-r--r--src/third_party/timelib-2017.05beta6/timezonedb.h (renamed from src/third_party/timelib-2017.05beta5/timezonedb.h)0
-rw-r--r--src/third_party/timelib-2017.05beta6/timezonemap.h (renamed from src/third_party/timelib-2017.05beta5/timezonemap.h)98
-rw-r--r--src/third_party/timelib-2017.05beta6/tm2unixtime.c (renamed from src/third_party/timelib-2017.05beta5/tm2unixtime.c)17
-rw-r--r--src/third_party/timelib-2017.05beta6/unixtime2tm.c (renamed from src/third_party/timelib-2017.05beta5/unixtime2tm.c)4
-rw-r--r--src/third_party/timelib-2017.05beta6/win_dirent.h (renamed from src/third_party/timelib-2017.05beta5/win_dirent.h)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/Makefile (renamed from src/third_party/timelib-2017.05beta5/zones/Makefile)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/README.rst (renamed from src/third_party/timelib-2017.05beta5/zones/README.rst)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/build-idx.php (renamed from src/third_party/timelib-2017.05beta5/zones/build-idx.php)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/create-entry.php (renamed from src/third_party/timelib-2017.05beta5/zones/create-entry.php)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/create_dot_h_file.php (renamed from src/third_party/timelib-2017.05beta5/zones/create_dot_h_file.php)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/sort-index.php (renamed from src/third_party/timelib-2017.05beta5/zones/sort-index.php)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/update-package-version.php (renamed from src/third_party/timelib-2017.05beta5/zones/update-package-version.php)0
-rw-r--r--src/third_party/timelib-2017.05beta6/zones/update-package-xml.php (renamed from src/third_party/timelib-2017.05beta5/zones/update-package-xml.php)0
41 files changed, 1278 insertions, 906 deletions
diff --git a/src/third_party/SConscript b/src/third_party/SConscript
index e24497f67dd..24192468241 100644
--- a/src/third_party/SConscript
+++ b/src/third_party/SConscript
@@ -13,7 +13,7 @@ mozjsSuffix = '-45'
yamlSuffix = '-0.5.3'
icuSuffix = '-57.1'
gperftoolsSuffix = '-2.5'
-timelibSuffix = '-2017.05beta5'
+timelibSuffix = '-2017.05beta6'
tomcryptSuffix = '-1.18.0-rc2'
thirdPartyIncludePathList = [
diff --git a/src/third_party/scripts/timelib_get_sources.sh b/src/third_party/scripts/timelib_get_sources.sh
index dae67bf61e0..373c463bf8f 100755
--- a/src/third_party/scripts/timelib_get_sources.sh
+++ b/src/third_party/scripts/timelib_get_sources.sh
@@ -12,7 +12,7 @@ set -o errexit
# parser to hang.
#
-VERSION=2017.05beta5
+VERSION=2017.05beta6
NAME=timelib
TARBALL=$VERSION.tar.gz
TARBALL_DIR=$NAME-$VERSION
diff --git a/src/third_party/timelib-2017.05beta5/fallbackmap.h b/src/third_party/timelib-2017.05beta5/fallbackmap.h
deleted file mode 100644
index af69482c0cb..00000000000
--- a/src/third_party/timelib-2017.05beta5/fallbackmap.h
+++ /dev/null
@@ -1,42 +0,0 @@
- { "sst", 0, -660, "Pacific/Apia" },
- { "hst", 0, -600, "Pacific/Honolulu" },
- { "akst", 0, -540, "America/Anchorage" },
- { "akdt", 1, -480, "America/Anchorage" },
- { "pst", 0, -480, "America/Los_Angeles" },
- { "pdt", 1, -420, "America/Los_Angeles" },
- { "mst", 0, -420, "America/Denver" },
- { "mdt", 1, -360, "America/Denver" },
- { "cst", 0, -360, "America/Chicago" },
- { "cdt", 1, -300, "America/Chicago" },
- { "est", 0, -300, "America/New_York" },
- { "vet", 0, -270, "America/Caracas" },
- { "edt", 1, -240, "America/New_York" },
- { "ast", 0, -240, "America/Halifax" },
- { "adt", 1, -180, "America/Halifax" },
- { "brt", 0, -180, "America/Sao_Paulo" },
- { "brst", 1, -120, "America/Sao_Paulo" },
- { "azost", 0, -60, "Atlantic/Azores" },
- { "azodt", 1, 0, "Atlantic/Azores" },
- { "gmt", 0, 0, "Europe/London" },
- { "bst", 1, 60, "Europe/London" },
- { "cet", 0, 60, "Europe/Paris" },
- { "cest", 1, 120, "Europe/Paris" },
- { "eet", 0, 120, "Europe/Helsinki" },
- { "eest", 1, 180, "Europe/Helsinki" },
- { "msk", 0, 180, "Europe/Moscow" },
- { "msd", 1, 240, "Europe/Moscow" },
- { "gst", 0, 240, "Asia/Dubai" },
- { "pkt", 0, 300, "Asia/Karachi" },
- { "ist", 0, 330, "Asia/Kolkata" },
- { "npt", 0, 345, "Asia/Katmandu" },
- { "yekt", 1, 360, "Asia/Yekaterinburg" },
- { "novst", 1, 420, "Asia/Novosibirsk" },
- { "krat", 0, 420, "Asia/Krasnoyarsk" },
- { "cst", 0, 480, "Asia/Shanghai" },
- { "krast", 1, 480, "Asia/Krasnoyarsk" },
- { "jst", 0, 540, "Asia/Tokyo" },
- { "est", 0, 600, "Australia/Melbourne" },
- { "cst", 1, 630, "Australia/Adelaide" },
- { "est", 1, 660, "Australia/Melbourne" },
- { "nzst", 0, 720, "Pacific/Auckland" },
- { "nzdt", 1, 780, "Pacific/Auckland" },
diff --git a/src/third_party/timelib-2017.05beta5/timelib.h b/src/third_party/timelib-2017.05beta5/timelib.h
deleted file mode 100644
index 9d76248dff3..00000000000
--- a/src/third_party/timelib-2017.05beta5/timelib.h
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Derick Rethans
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef __TIMELIB_H__
-#define __TIMELIB_H__
-
-#ifdef HAVE_TIMELIB_CONFIG_H
-# include "timelib_config.h"
-#endif
-
-#include <stdlib.h>
-#include <limits.h>
-#include <inttypes.h>
-
-# ifndef HAVE_INT32_T
-# if SIZEOF_INT == 4
-typedef int int32_t;
-# elif SIZEOF_LONG == 4
-typedef long int int32_t;
-# endif
-# endif
-
-# ifndef HAVE_UINT32_T
-# if SIZEOF_INT == 4
-typedef unsigned int uint32_t;
-# elif SIZEOF_LONG == 4
-typedef unsigned long int uint32_t;
-# endif
-# endif
-
-#ifdef _WIN32
-# if _MSC_VER >= 1600
-# include <stdint.h>
-# endif
-# ifndef SIZEOF_INT
-# define SIZEOF_INT 4
-# endif
-# ifndef SIZEOF_LONG
-# define SIZEOF_LONG 4
-# endif
-# ifndef int32_t
-typedef __int32 int32_t;
-# endif
-# ifndef uint32_t
-typedef unsigned __int32 uint32_t;
-# endif
-# ifndef int64_t
-typedef __int64 int64_t;
-# endif
-# ifndef uint64_t
-typedef unsigned __int64 uint64_t;
-# endif
-# ifndef PRId32
-# define PRId32 "I32d"
-# endif
-# ifndef PRIu32
-# define PRIu32 "I32u"
-# endif
-# ifndef PRId64
-# define PRId64 "I64d"
-# endif
-# ifndef PRIu64
-# define PRIu64 "I64u"
-# endif
-# ifndef INT32_MAX
-#define INT32_MAX _I32_MAX
-# endif
-# ifndef INT32_MIN
-#define INT32_MIN ((int32_t)_I32_MIN)
-# endif
-# ifndef UINT32_MAX
-#define UINT32_MAX _UI32_MAX
-# endif
-# ifndef INT64_MIN
-#define INT64_MIN ((int64_t)_I64_MIN)
-# endif
-# ifndef INT64_MAX
-#define INT64_MAX _I64_MAX
-# endif
-# ifndef UINT64_MAX
-#define UINT64_MAX _UI64_MAX
-# endif
-#endif
-
-#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
-typedef int64_t timelib_long;
-typedef uint64_t timelib_ulong;
-# define TIMELIB_LONG_MAX INT64_MAX
-# define TIMELIB_LONG_MIN INT64_MIN
-# define TIMELIB_ULONG_MAX UINT64_MAX
-# define TIMELIB_LONG_FMT "%" PRId64
-# define TIMELIB_ULONG_FMT "%" PRIu64
-#else
-typedef int32_t timelib_long;
-typedef uint32_t timelib_ulong;
-# define TIMELIB_LONG_MAX INT32_MAX
-# define TIMELIB_LONG_MIN INT32_MIN
-# define TIMELIB_ULONG_MAX UINT32_MAX
-# define TIMELIB_LONG_FMT "%" PRId32
-# define TIMELIB_ULONG_FMT "%" PRIu32
-#endif
-
-#if defined(_MSC_VER)
-typedef uint64_t timelib_ull;
-typedef int64_t timelib_sll;
-# define TIMELIB_LL_CONST(n) n ## i64
-#else
-typedef unsigned long long timelib_ull;
-typedef signed long long timelib_sll;
-# define TIMELIB_LL_CONST(n) n ## ll
-#endif
-
-typedef struct ttinfo ttinfo;
-typedef struct tlinfo tlinfo;
-
-typedef struct tlocinfo
-{
- char country_code[3];
- double latitude;
- double longitude;
- char *comments;
-} tlocinfo;
-
-typedef struct timelib_tzinfo
-{
- char *name;
- struct {
- uint32_t ttisgmtcnt;
- uint32_t ttisstdcnt;
- uint32_t leapcnt;
- uint32_t timecnt;
- uint32_t typecnt;
- uint32_t charcnt;
- } bit32;
- struct {
- uint64_t ttisgmtcnt;
- uint64_t ttisstdcnt;
- uint64_t leapcnt;
- uint64_t timecnt;
- uint64_t typecnt;
- uint64_t charcnt;
- } bit64;
-
- int32_t *trans;
- unsigned char *trans_idx;
-
- ttinfo *type;
- char *timezone_abbr;
-
- tlinfo *leap_times;
- unsigned char bc;
- tlocinfo location;
-} timelib_tzinfo;
-
-typedef struct timelib_rel_time {
- timelib_sll y, m, d; /* Years, Months and Days */
- timelib_sll h, i, s; /* Hours, mInutes and Seconds */
- timelib_sll us; /* Microseconds */
-
- int weekday; /* Stores the day in 'next monday' */
- int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
-
- int first_last_day_of;
- int invert; /* Whether the difference should be inverted */
- timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
-
- struct {
- unsigned int type;
- timelib_sll amount;
- } special;
-
- unsigned int have_weekday_relative, have_special_relative;
-} timelib_rel_time;
-
-typedef struct timelib_time_offset {
- int32_t offset;
- unsigned int leap_secs;
- unsigned int is_dst;
- char *abbr;
- timelib_sll transistion_time;
-} timelib_time_offset;
-
-typedef struct timelib_time {
- timelib_sll y, m, d; /* Year, Month, Day */
- timelib_sll h, i, s; /* Hour, mInute, Second */
- timelib_sll us; /* Microseconds */
- int z; /* UTC offset in seconds */
- char *tz_abbr; /* Timezone abbreviation (display only) */
- timelib_tzinfo *tz_info; /* Timezone structure */
- signed int dst; /* Flag if we were parsing a DST zone */
- timelib_rel_time relative;
-
- timelib_sll sse; /* Seconds since epoch */
-
- unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
-
- unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
- unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
- unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
- unsigned int zone_type; /* 1 time offset,
- * 3 TimeZone identifier,
- * 2 TimeZone abbreviation */
-} timelib_time;
-
-typedef struct timelib_abbr_info {
- timelib_sll utc_offset;
- char *abbr;
- int dst;
-} timelib_abbr_info;
-
-#define TIMELIB_WARN_MASK 0x1ff
-#define TIMELIB_ERR_MASK 0x2ff
-
-#define TIMELIB_WARN_DOUBLE_TZ 0x101
-#define TIMELIB_WARN_INVALID_TIME 0x102
-#define TIMELIB_WARN_INVALID_DATE 0x103
-#define TIMELIB_WARN_TRAILING_DATA 0x11a
-
-#define TIMELIB_ERR_DOUBLE_TZ 0x201
-#define TIMELIB_ERR_TZID_NOT_FOUND 0x202
-#define TIMELIB_ERR_DOUBLE_TIME 0x203
-#define TIMELIB_ERR_DOUBLE_DATE 0x204
-#define TIMELIB_ERR_UNEXPECTED_CHARACTER 0x205
-#define TIMELIB_ERR_EMPTY_STRING 0x206
-#define TIMELIB_ERR_UNEXPECTED_DATA 0x207
-#define TIMELIB_ERR_NO_TEXTUAL_DAY 0x208
-#define TIMELIB_ERR_NO_TWO_DIGIT_DAY 0x209
-#define TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR 0x20a
-#define TIMELIB_ERR_NO_TWO_DIGIT_MONTH 0x20b
-#define TIMELIB_ERR_NO_TEXTUAL_MONTH 0x20c
-#define TIMELIB_ERR_NO_TWO_DIGIT_YEAR 0x20d
-#define TIMELIB_ERR_NO_FOUR_DIGIT_YEAR 0x20e
-#define TIMELIB_ERR_NO_TWO_DIGIT_HOUR 0x20f
-#define TIMELIB_ERR_HOUR_LARGER_THAN_12 0x210
-#define TIMELIB_ERR_MERIDIAN_BEFORE_HOUR 0x211
-#define TIMELIB_ERR_NO_MERIDIAN 0x212
-#define TIMELIB_ERR_NO_TWO_DIGIT_MINUTE 0x213
-#define TIMELIB_ERR_NO_TWO_DIGIT_SECOND 0x214
-#define TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND 0x215
-#define TIMELIB_ERR_NO_SEP_SYMBOL 0x216
-#define TIMELIB_ERR_EXPECTED_ESCAPE_CHAR 0x217
-#define TIMELIB_ERR_NO_ESCAPED_CHAR 0x218
-#define TIMELIB_ERR_WRONG_FORMAT_SEP 0x219
-#define TIMELIB_ERR_TRAILING_DATA 0x21a
-#define TIMELIB_ERR_DATA_MISSING 0x21b
-
-
-
-
-typedef struct timelib_error_message {
- int error_code;
- int position;
- char character;
- char *message;
-} timelib_error_message;
-
-typedef struct timelib_error_container {
- struct timelib_error_message *error_messages;
- struct timelib_error_message *warning_messages;
- int error_count;
- int warning_count;
-} timelib_error_container;
-
-typedef struct _timelib_tz_lookup_table {
- char *name;
- int type;
- float gmtoffset;
- char *full_tz_name;
-} timelib_tz_lookup_table;
-
-typedef struct _timelib_tzdb_index_entry {
- char *id;
- unsigned int pos;
-} timelib_tzdb_index_entry;
-
-typedef struct _timelib_tzdb {
- char *version;
- int index_size;
- const timelib_tzdb_index_entry *index;
- const unsigned char *data;
-} timelib_tzdb;
-
-#ifndef timelib_malloc
-# define timelib_malloc malloc
-# define timelib_realloc realloc
-# define timelib_calloc calloc
-# define timelib_strdup strdup
-# define timelib_free free
-#endif
-
-#define TIMELIB_VERSION 201705
-#define TIMELIB_ASCII_VERSION "2017.05beta2"
-
-#define TIMELIB_NONE 0x00
-#define TIMELIB_OVERRIDE_TIME 0x01
-#define TIMELIB_NO_CLONE 0x02
-
-#define TIMELIB_UNSET -99999
-
-/* An entry for each of these error codes is also in the
- * timelib_error_messages array in timelib.c */
-#define TIMELIB_ERROR_NO_ERROR 0x00
-#define TIMELIB_ERROR_CANNOT_ALLOCATE 0x01
-#define TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE 0x02
-#define TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE 0x03
-#define TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION 0x04
-#define TIMELIB_ERROR_UNSUPPORTED_VERSION 0x05
-#define TIMELIB_ERROR_NO_SUCH_TIMEZONE 0x06
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function pointers */
-typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb, int *error_code);
-
-/* From dow.c */
-timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
-timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
-timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d);
-timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id);
-timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
-
-void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
-void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id);
-
-void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d);
-
-int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
-int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
-
-/* From parse_date.re */
-timelib_time *timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
-timelib_time *timelib_parse_from_format(char *format, char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
-void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
-char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
-const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
-timelib_long timelib_parse_tz_cor(char**);
-timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
-
-/* From parse_iso_intervals.re */
-void timelib_strtointerval(char *s, size_t len,
- timelib_time **begin, timelib_time **end,
- timelib_rel_time **period, int *recurrences,
- struct timelib_error_container **errors);
-
-
-/* From tm2unixtime.c */
-void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
-void timelib_do_normalize(timelib_time *base);
-void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt);
-
-/* From unixtime2tm.c */
-int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
-void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
-void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
-void timelib_update_from_sse(timelib_time *tm);
-void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
-void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
-void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
-
-/* From parse_tz.c */
-int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
-timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code);
-int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
-timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
-timelib_sll timelib_get_current_offset(timelib_time *t);
-void timelib_dump_tzinfo(timelib_tzinfo *tz);
-const timelib_tzdb *timelib_builtin_db(void);
-const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count);
-
-/* From parse_zoneinfo.c */
-timelib_tzdb *timelib_zoneinfo(char *directory);
-void timelib_zoneinfo_dtor(timelib_tzdb *tzdb);
-
-/* From timelib.c */
-
-/* Returns a static string containing an error message belonging to a specific
- * error code. */
-const char *timelib_get_error_message(int error_code);
-
-timelib_tzinfo* timelib_tzinfo_ctor(char *name);
-void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
-void timelib_time_tz_name_update(timelib_time* tm, char* tz_name);
-void timelib_tzinfo_dtor(timelib_tzinfo *tz);
-timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
-
-timelib_rel_time* timelib_rel_time_ctor(void);
-void timelib_rel_time_dtor(timelib_rel_time* t);
-timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *tz);
-
-timelib_time* timelib_time_ctor(void);
-void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
-void timelib_time_dtor(timelib_time* t);
-timelib_time* timelib_time_clone(timelib_time* orig);
-int timelib_time_compare(timelib_time *t1, timelib_time *t2);
-
-timelib_time_offset* timelib_time_offset_ctor(void);
-void timelib_time_offset_dtor(timelib_time_offset* t);
-
-void timelib_error_container_dtor(timelib_error_container *errors);
-
-timelib_long timelib_date_to_int(timelib_time *d, int *error);
-void timelib_dump_date(timelib_time *d, int options);
-void timelib_dump_rel_time(timelib_rel_time *d);
-
-void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
-timelib_long timelib_parse_tz_cor(char **ptr);
-
-/* from astro.c */
-double timelib_ts_to_juliandate(timelib_sll ts);
-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);
-
-/* from interval.c */
-timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two);
-timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval);
-timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif
diff --git a/src/third_party/timelib-2017.05beta5/LICENSE.rst b/src/third_party/timelib-2017.05beta6/LICENSE.rst
index 70bf7b00bde..70bf7b00bde 100644
--- a/src/third_party/timelib-2017.05beta5/LICENSE.rst
+++ b/src/third_party/timelib-2017.05beta6/LICENSE.rst
diff --git a/src/third_party/timelib-2017.05beta5/Makefile b/src/third_party/timelib-2017.05beta6/Makefile
index 4d6cffc891e..17e6a9f87be 100644
--- a/src/third_party/timelib-2017.05beta5/Makefile
+++ b/src/third_party/timelib-2017.05beta6/Makefile
@@ -1,16 +1,25 @@
-CFLAGS=-O0 -ggdb3 \
+FLAGS=-O0 -ggdb3 \
-Wall -Werror -Wextra -fsanitize=undefined -fsanitize=address \
- -Wmaybe-uninitialized -Wdeclaration-after-statement -Wmissing-field-initializers -Wshadow -Wno-unused-parameter \
+ -Wmaybe-uninitialized -Wmissing-field-initializers -Wshadow -Wno-unused-parameter \
-pedantic \
-DHAVE_STDINT_H -DHAVE_STRING_H -DHAVE_GETTIMEOFDAY -DHAVE_UNISTD_H -DHAVE_DIRENT_H -I.# -DDEBUG_PARSER
+CFLAGS=-Wdeclaration-after-statement ${FLAGS}
+
+CPPFLAGS=${FLAGS}
+
LDFLAGS=-lm -fsanitize=undefined
+
+TEST_LDFLAGS=-lCppUTest
+
CC=gcc
MANUAL_TESTS=tests/tester-parse-interval \
tests/tester-parse-tz tests/tester-iso-week tests/test-abbr-to-id \
tests/enumerate-timezones tests/date_from_isodate
AUTO_TESTS=tests/tester-parse-string tests/tester-parse-string-by-format \
tests/tester-create-ts tests/tester-render-ts tests/tester-render-ts-zoneinfo
+C_TESTS=tests/c/timelib_get_current_offset_test.cpp tests/c/timelib_decimal_hour.cpp \
+ tests/c/timelib_juliandate.cpp
TEST_BINARIES=${MANUAL_TESTS} ${AUTO_TESTS}
EXAMPLE_BINARIES=docs/date-from-iso-parts docs/date-from-parts docs/date-from-string \
@@ -91,8 +100,13 @@ clean-all: clean
clean:
rm -f parse_iso_intervals.c parse_date.c *.o timelib.a ${TEST_BINARIES}
-test: tests/tester-parse-string tests/tester-create-ts tests/tester-render-ts tests/tester-render-ts-zoneinfo tests/tester-parse-string-by-format
- php tests/test_all.php
+ctest: tests/c/all_tests.cpp timelib.a ${C_TESTS}
+ g++ $(CPPFLAGS) $(LDFLAGS) tests/c/all_tests.cpp ${C_TESTS} timelib.a $(TEST_LDFLAGS) -o ctest
+
+test: ctest tests/tester-parse-string tests/tester-create-ts tests/tester-render-ts tests/tester-render-ts-zoneinfo tests/tester-parse-string-by-format
+ -@php tests/test_all.php
+ @echo Running C tests
+ @./ctest -c
test-parse-string: tests/tester-parse-string
@for i in tests/files/*.parse; do echo $$i; php tests/test_parser.php $$i; echo; done
diff --git a/src/third_party/timelib-2017.05beta5/README.rst b/src/third_party/timelib-2017.05beta6/README.rst
index 23faac381fe..23faac381fe 100644
--- a/src/third_party/timelib-2017.05beta5/README.rst
+++ b/src/third_party/timelib-2017.05beta6/README.rst
diff --git a/src/third_party/timelib-2017.05beta5/SConscript b/src/third_party/timelib-2017.05beta6/SConscript
index c7c51ab862e..c7c51ab862e 100644
--- a/src/third_party/timelib-2017.05beta5/SConscript
+++ b/src/third_party/timelib-2017.05beta6/SConscript
diff --git a/src/third_party/timelib-2017.05beta5/astro.c b/src/third_party/timelib-2017.05beta6/astro.c
index 847d5fffbf5..b9ea22977c6 100644
--- a/src/third_party/timelib-2017.05beta5/astro.c
+++ b/src/third_party/timelib-2017.05beta6/astro.c
@@ -299,10 +299,10 @@ double timelib_ts_to_juliandate(timelib_sll ts)
{
double tmp;
- tmp = ts;
- tmp /= 86400;
- tmp += 2440587.5;
- tmp -= 2451543;
+ tmp = (double) ts;
+ tmp /= (double) 86400;
+ tmp += (double) 2440587.5;
+ tmp -= 2451545;
return tmp;
}
diff --git a/src/third_party/timelib-2017.05beta5/astro.h b/src/third_party/timelib-2017.05beta6/astro.h
index 8b2b800b526..8b2b800b526 100644
--- a/src/third_party/timelib-2017.05beta5/astro.h
+++ b/src/third_party/timelib-2017.05beta6/astro.h
diff --git a/src/third_party/timelib-2017.05beta5/docs/date-from-iso-parts.c b/src/third_party/timelib-2017.05beta6/docs/date-from-iso-parts.c
index d93f3899b0e..d93f3899b0e 100644
--- a/src/third_party/timelib-2017.05beta5/docs/date-from-iso-parts.c
+++ b/src/third_party/timelib-2017.05beta6/docs/date-from-iso-parts.c
diff --git a/src/third_party/timelib-2017.05beta5/docs/date-from-parts.c b/src/third_party/timelib-2017.05beta6/docs/date-from-parts.c
index ec7186ce9aa..ec7186ce9aa 100644
--- a/src/third_party/timelib-2017.05beta5/docs/date-from-parts.c
+++ b/src/third_party/timelib-2017.05beta6/docs/date-from-parts.c
diff --git a/src/third_party/timelib-2017.05beta5/docs/date-from-string.c b/src/third_party/timelib-2017.05beta6/docs/date-from-string.c
index ef4ffeebd61..ef4ffeebd61 100644
--- a/src/third_party/timelib-2017.05beta5/docs/date-from-string.c
+++ b/src/third_party/timelib-2017.05beta6/docs/date-from-string.c
diff --git a/src/third_party/timelib-2017.05beta5/docs/date-to-parts.c b/src/third_party/timelib-2017.05beta6/docs/date-to-parts.c
index 5287dac9bf6..5287dac9bf6 100644
--- a/src/third_party/timelib-2017.05beta5/docs/date-to-parts.c
+++ b/src/third_party/timelib-2017.05beta6/docs/date-to-parts.c
diff --git a/src/third_party/timelib-2017.05beta5/dow.c b/src/third_party/timelib-2017.05beta6/dow.c
index 33553e7806f..33553e7806f 100644
--- a/src/third_party/timelib-2017.05beta5/dow.c
+++ b/src/third_party/timelib-2017.05beta6/dow.c
diff --git a/src/third_party/timelib-2017.05beta6/fallbackmap.h b/src/third_party/timelib-2017.05beta6/fallbackmap.h
new file mode 100644
index 00000000000..5a4c6123c3a
--- /dev/null
+++ b/src/third_party/timelib-2017.05beta6/fallbackmap.h
@@ -0,0 +1,42 @@
+ { "sst", 0, -660 * 60, "Pacific/Apia" },
+ { "hst", 0, -600 * 60, "Pacific/Honolulu" },
+ { "akst", 0, -540 * 60, "America/Anchorage" },
+ { "akdt", 1, -480 * 60, "America/Anchorage" },
+ { "pst", 0, -480 * 60, "America/Los_Angeles" },
+ { "pdt", 1, -420 * 60, "America/Los_Angeles" },
+ { "mst", 0, -420 * 60, "America/Denver" },
+ { "mdt", 1, -360 * 60, "America/Denver" },
+ { "cst", 0, -360 * 60, "America/Chicago" },
+ { "cdt", 1, -300 * 60, "America/Chicago" },
+ { "est", 0, -300 * 60, "America/New_York" },
+ { "vet", 0, -270 * 60, "America/Caracas" },
+ { "edt", 1, -240 * 60, "America/New_York" },
+ { "ast", 0, -240 * 60, "America/Halifax" },
+ { "adt", 1, -180 * 60, "America/Halifax" },
+ { "brt", 0, -180 * 60, "America/Sao_Paulo" },
+ { "brst", 1, -120 * 60, "America/Sao_Paulo" },
+ { "azost", 0, -60 * 60, "Atlantic/Azores" },
+ { "azodt", 1, 0 * 60, "Atlantic/Azores" },
+ { "gmt", 0, 0 * 60, "Europe/London" },
+ { "bst", 1, 60 * 60, "Europe/London" },
+ { "cet", 0, 60 * 60, "Europe/Paris" },
+ { "cest", 1, 120 * 60, "Europe/Paris" },
+ { "eet", 0, 120 * 60, "Europe/Helsinki" },
+ { "eest", 1, 180 * 60, "Europe/Helsinki" },
+ { "msk", 0, 180 * 60, "Europe/Moscow" },
+ { "msd", 1, 240 * 60, "Europe/Moscow" },
+ { "gst", 0, 240 * 60, "Asia/Dubai" },
+ { "pkt", 0, 300 * 60, "Asia/Karachi" },
+ { "ist", 0, 330 * 60, "Asia/Kolkata" },
+ { "npt", 0, 345 * 60, "Asia/Katmandu" },
+ { "yekt", 1, 360 * 60, "Asia/Yekaterinburg" },
+ { "novst", 1, 420 * 60, "Asia/Novosibirsk" },
+ { "krat", 0, 420 * 60, "Asia/Krasnoyarsk" },
+ { "cst", 0, 480 * 60, "Asia/Shanghai" },
+ { "krast", 1, 480 * 60, "Asia/Krasnoyarsk" },
+ { "jst", 0, 540 * 60, "Asia/Tokyo" },
+ { "est", 0, 600 * 60, "Australia/Melbourne" },
+ { "cst", 1, 630 * 60, "Australia/Adelaide" },
+ { "est", 1, 660 * 60, "Australia/Melbourne" },
+ { "nzst", 0, 720 * 60, "Pacific/Auckland" },
+ { "nzdt", 1, 780 * 60, "Pacific/Auckland" },
diff --git a/src/third_party/timelib-2017.05beta5/gettzmapping.php b/src/third_party/timelib-2017.05beta6/gettzmapping.php
index 0619ede5af8..3a94791b7fe 100644
--- a/src/third_party/timelib-2017.05beta5/gettzmapping.php
+++ b/src/third_party/timelib-2017.05beta6/gettzmapping.php
@@ -778,6 +778,9 @@
if (preg_match( '/^[+-][0-9]{2}$/', $trans['abbr'] ) ) {
continue;
}
+ if (preg_match( '/^[+-][0-9]{4}$/', $trans['abbr'] ) ) {
+ continue;
+ }
if ($trans['abbr'] == 'LMT') {
continue;
}
diff --git a/src/third_party/timelib-2017.05beta5/interval.c b/src/third_party/timelib-2017.05beta6/interval.c
index e034392a0f9..e034392a0f9 100644
--- a/src/third_party/timelib-2017.05beta5/interval.c
+++ b/src/third_party/timelib-2017.05beta6/interval.c
diff --git a/src/third_party/timelib-2017.05beta5/parse_date.c b/src/third_party/timelib-2017.05beta6/parse_date.c
index 78d2018f227..c3205fd51d1 100644
--- a/src/third_party/timelib-2017.05beta5/parse_date.c
+++ b/src/third_party/timelib-2017.05beta6/parse_date.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.15.3 on Thu Jul 13 17:00:36 2017 */
+/* Generated by re2c 0.15.3 on Thu Jul 27 12:07:30 2017 */
#line 1 "parse_date.re"
/*
* The MIT License (MIT)
@@ -43,18 +43,6 @@
# endif
#endif
-#define TIMELIB_UNSET -99999
-
-#define TIMELIB_SECOND 1
-#define TIMELIB_MINUTE 2
-#define TIMELIB_HOUR 3
-#define TIMELIB_DAY 4
-#define TIMELIB_MONTH 5
-#define TIMELIB_YEAR 6
-#define TIMELIB_WEEKDAY 7
-#define TIMELIB_SPECIAL 8
-#define TIMELIB_MICROSEC 9
-
#define EOI 257
#define TIME 258
#define DATE 259
@@ -715,7 +703,7 @@ static const timelib_tz_lookup_table* abbr_search(const char *word, timelib_long
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
- if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
+ if (fmp->gmtoffset == gmtoffset && fmp->type == isdst) {
return fmp;
}
}
@@ -737,9 +725,9 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
memcpy(word, begin, end - begin);
if ((tp = abbr_search(word, -1, 0))) {
- value = -tp->gmtoffset / 60;
+ value = tp->gmtoffset;
*dst = tp->type;
- value += tp->type * 60;
+ value -= tp->type * 3600;
*found = 1;
} else {
*found = 0;
@@ -749,7 +737,43 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
return value;
}
-timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
+#define sHOUR(a) (int)(a * 3600)
+#define sMIN(a) (int)(a * 60)
+
+static timelib_long timelib_parse_tz_cor(char **ptr)
+{
+ char *begin = *ptr, *end;
+ timelib_long tmp;
+
+ while (isdigit(**ptr) || **ptr == ':') {
+ ++*ptr;
+ }
+ end = *ptr;
+ switch (end - begin) {
+ case 1: /* H */
+ case 2: /* HH */
+ return sHOUR(strtol(begin, NULL, 10));
+ break;
+ case 3: /* H:M */
+ case 4: /* H:MM, HH:M, HHMM */
+ if (begin[1] == ':') {
+ tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 2, NULL, 10));
+ return tmp;
+ } else if (begin[2] == ':') {
+ tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
+ return tmp;
+ } else {
+ tmp = strtol(begin, NULL, 10);
+ return sHOUR(tmp / 100) + sMIN(tmp % 100);
+ }
+ case 5: /* HH:MM */
+ tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
+ return tmp;
+ }
+ return 0;
+}
+
+static timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
{
timelib_tzinfo *res;
timelib_long retval = 0;
@@ -769,7 +793,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
*tz_not_found = 0;
t->dst = 0;
- retval = -1 * timelib_parse_tz_cor(ptr);
+ retval = timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
++*ptr;
t->is_localtime = 1;
@@ -777,7 +801,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
*tz_not_found = 0;
t->dst = 0;
- retval = timelib_parse_tz_cor(ptr);
+ retval = -1 * timelib_parse_tz_cor(ptr);
} else {
int found = 0;
timelib_long offset = 0;
@@ -830,11 +854,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
-#line 957 "parse_date.re"
+#line 981 "parse_date.re"
-#line 838 "<stdout>"
+#line 862 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -972,7 +996,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
-#line 1665 "parse_date.re"
+#line 1689 "parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -985,7 +1009,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 989 "<stdout>"
+#line 1013 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1294,12 +1318,12 @@ yy11:
if (yych <= '9') goto yy1375;
yy12:
YYDEBUG(12, *YYCURSOR);
-#line 1760 "parse_date.re"
+#line 1784 "parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
-#line 1303 "<stdout>"
+#line 1327 "<stdout>"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2543,11 +2567,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
-#line 1749 "parse_date.re"
+#line 1773 "parse_date.re"
{
goto std;
}
-#line 2551 "<stdout>"
+#line 2575 "<stdout>"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2556,12 +2580,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
-#line 1754 "parse_date.re"
+#line 1778 "parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 2565 "<stdout>"
+#line 2589 "<stdout>"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2997,7 +3021,7 @@ yy73:
if (yych == 's') goto yy75;
yy74:
YYDEBUG(74, *YYCURSOR);
-#line 1733 "parse_date.re"
+#line 1757 "parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -3012,7 +3036,7 @@ yy74:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 3016 "<stdout>"
+#line 3040 "<stdout>"
yy75:
YYDEBUG(75, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3915,7 +3939,7 @@ yy190:
}
yy191:
YYDEBUG(191, *YYCURSOR);
-#line 1596 "parse_date.re"
+#line 1620 "parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3932,7 +3956,7 @@ yy191:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
-#line 3936 "<stdout>"
+#line 3960 "<stdout>"
yy192:
YYDEBUG(192, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4452,7 +4476,7 @@ yy217:
}
yy218:
YYDEBUG(218, *YYCURSOR);
-#line 1655 "parse_date.re"
+#line 1679 "parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4461,7 +4485,7 @@ yy218:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 4465 "<stdout>"
+#line 4489 "<stdout>"
yy219:
YYDEBUG(219, *YYCURSOR);
++YYCURSOR;
@@ -4710,7 +4734,7 @@ yy231:
goto yy237;
yy232:
YYDEBUG(232, *YYCURSOR);
-#line 1401 "parse_date.re"
+#line 1425 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4723,7 +4747,7 @@ yy232:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 4727 "<stdout>"
+#line 4751 "<stdout>"
yy233:
YYDEBUG(233, *YYCURSOR);
yyaccept = 6;
@@ -4850,7 +4874,7 @@ yy245:
}
yy246:
YYDEBUG(246, *YYCURSOR);
-#line 1703 "parse_date.re"
+#line 1727 "parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4879,7 +4903,7 @@ yy246:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 4883 "<stdout>"
+#line 4907 "<stdout>"
yy247:
YYDEBUG(247, *YYCURSOR);
yyaccept = 7;
@@ -5177,7 +5201,7 @@ yy270:
YYDEBUG(270, *YYCURSOR);
++YYCURSOR;
YYDEBUG(271, *YYCURSOR);
-#line 1679 "parse_date.re"
+#line 1703 "parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5200,7 +5224,7 @@ yy270:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 5204 "<stdout>"
+#line 5228 "<stdout>"
yy272:
YYDEBUG(272, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5807,7 +5831,7 @@ yy320:
YYDEBUG(321, *YYCURSOR);
++YYCURSOR;
YYDEBUG(322, *YYCURSOR);
-#line 1373 "parse_date.re"
+#line 1397 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5820,7 +5844,7 @@ yy320:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 5824 "<stdout>"
+#line 5848 "<stdout>"
yy323:
YYDEBUG(323, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6051,7 +6075,7 @@ yy327:
if (yych <= '9') goto yy331;
yy330:
YYDEBUG(330, *YYCURSOR);
-#line 1517 "parse_date.re"
+#line 1541 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6064,7 +6088,7 @@ yy330:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 6068 "<stdout>"
+#line 6092 "<stdout>"
yy331:
YYDEBUG(331, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6646,7 +6670,7 @@ yy356:
}
yy357:
YYDEBUG(357, *YYCURSOR);
-#line 1575 "parse_date.re"
+#line 1599 "parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -6666,7 +6690,7 @@ yy357:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 6670 "<stdout>"
+#line 6694 "<stdout>"
yy358:
YYDEBUG(358, *YYCURSOR);
yyaccept = 5;
@@ -8449,7 +8473,7 @@ yy418:
++YYCURSOR;
yy419:
YYDEBUG(419, *YYCURSOR);
-#line 1278 "parse_date.re"
+#line 1302 "parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -8460,7 +8484,7 @@ yy419:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 8464 "<stdout>"
+#line 8488 "<stdout>"
yy420:
YYDEBUG(420, *YYCURSOR);
yyaccept = 0;
@@ -9104,7 +9128,7 @@ yy439:
}
yy440:
YYDEBUG(440, *YYCURSOR);
-#line 1415 "parse_date.re"
+#line 1439 "parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9115,7 +9139,7 @@ yy440:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 9119 "<stdout>"
+#line 9143 "<stdout>"
yy441:
YYDEBUG(441, *YYCURSOR);
yyaccept = 9;
@@ -9256,7 +9280,7 @@ yy452:
YYDEBUG(452, *YYCURSOR);
++YYCURSOR;
YYDEBUG(453, *YYCURSOR);
-#line 1133 "parse_date.re"
+#line 1157 "parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9272,7 +9296,7 @@ yy452:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 9276 "<stdout>"
+#line 9300 "<stdout>"
yy454:
YYDEBUG(454, *YYCURSOR);
yyaccept = 10;
@@ -9285,7 +9309,7 @@ yy454:
}
yy455:
YYDEBUG(455, *YYCURSOR);
-#line 1170 "parse_date.re"
+#line 1194 "parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9310,7 +9334,7 @@ yy455:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 9314 "<stdout>"
+#line 9338 "<stdout>"
yy456:
YYDEBUG(456, *YYCURSOR);
yyaccept = 10;
@@ -9620,7 +9644,7 @@ yy487:
YYDEBUG(487, *YYCURSOR);
++YYCURSOR;
YYDEBUG(488, *YYCURSOR);
-#line 1150 "parse_date.re"
+#line 1174 "parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -9639,7 +9663,7 @@ yy487:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 9643 "<stdout>"
+#line 9667 "<stdout>"
yy489:
YYDEBUG(489, *YYCURSOR);
yyaccept = 10;
@@ -9745,7 +9769,7 @@ yy498:
if (yych <= '9') goto yy505;
yy499:
YYDEBUG(499, *YYCURSOR);
-#line 1332 "parse_date.re"
+#line 1356 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -9759,7 +9783,7 @@ yy499:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 9763 "<stdout>"
+#line 9787 "<stdout>"
yy500:
YYDEBUG(500, *YYCURSOR);
yych = *++YYCURSOR;
@@ -10495,7 +10519,7 @@ yy569:
YYDEBUG(570, *YYCURSOR);
++YYCURSOR;
YYDEBUG(571, *YYCURSOR);
-#line 1347 "parse_date.re"
+#line 1371 "parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -10506,7 +10530,7 @@ yy569:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 10510 "<stdout>"
+#line 10534 "<stdout>"
yy572:
YYDEBUG(572, *YYCURSOR);
yyaccept = 10;
@@ -10542,7 +10566,7 @@ yy575:
if (yych <= '9') goto yy569;
yy576:
YYDEBUG(576, *YYCURSOR);
-#line 1359 "parse_date.re"
+#line 1383 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -10555,7 +10579,7 @@ yy576:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 10559 "<stdout>"
+#line 10583 "<stdout>"
yy577:
YYDEBUG(577, *YYCURSOR);
yyaccept = 10;
@@ -11196,7 +11220,7 @@ yy620:
}
yy621:
YYDEBUG(621, *YYCURSOR);
-#line 1318 "parse_date.re"
+#line 1342 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11209,7 +11233,7 @@ yy621:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 11213 "<stdout>"
+#line 11237 "<stdout>"
yy622:
YYDEBUG(622, *YYCURSOR);
yyaccept = 12;
@@ -11315,7 +11339,7 @@ yy630:
}
yy631:
YYDEBUG(631, *YYCURSOR);
-#line 1262 "parse_date.re"
+#line 1286 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11330,7 +11354,7 @@ yy631:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 11334 "<stdout>"
+#line 11358 "<stdout>"
yy632:
YYDEBUG(632, *YYCURSOR);
yyaccept = 13;
@@ -11563,7 +11587,7 @@ yy664:
if (yych <= ':') goto yy668;
yy665:
YYDEBUG(665, *YYCURSOR);
-#line 1545 "parse_date.re"
+#line 1569 "parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -11583,7 +11607,7 @@ yy665:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 11587 "<stdout>"
+#line 11611 "<stdout>"
yy666:
YYDEBUG(666, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12133,7 +12157,7 @@ yy727:
}
yy728:
YYDEBUG(728, *YYCURSOR);
-#line 1290 "parse_date.re"
+#line 1314 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12146,7 +12170,7 @@ yy728:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 12150 "<stdout>"
+#line 12174 "<stdout>"
yy729:
YYDEBUG(729, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12185,7 +12209,7 @@ yy735:
YYDEBUG(735, *YYCURSOR);
++YYCURSOR;
YYDEBUG(736, *YYCURSOR);
-#line 1531 "parse_date.re"
+#line 1555 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12198,7 +12222,7 @@ yy735:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 12202 "<stdout>"
+#line 12226 "<stdout>"
yy737:
YYDEBUG(737, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12363,7 +12387,7 @@ yy747:
}
yy748:
YYDEBUG(748, *YYCURSOR);
-#line 1566 "parse_date.re"
+#line 1590 "parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12371,7 +12395,7 @@ yy748:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 12375 "<stdout>"
+#line 12399 "<stdout>"
yy749:
YYDEBUG(749, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12576,7 +12600,7 @@ yy757:
}
yy758:
YYDEBUG(758, *YYCURSOR);
-#line 1387 "parse_date.re"
+#line 1411 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -12589,7 +12613,7 @@ yy758:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 12593 "<stdout>"
+#line 12617 "<stdout>"
yy759:
YYDEBUG(759, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12810,7 +12834,7 @@ yy778:
if (yych <= '7') goto yy781;
yy779:
YYDEBUG(779, *YYCURSOR);
-#line 1498 "parse_date.re"
+#line 1522 "parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -12828,7 +12852,7 @@ yy779:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 12832 "<stdout>"
+#line 12856 "<stdout>"
yy780:
YYDEBUG(780, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12838,7 +12862,7 @@ yy781:
YYDEBUG(781, *YYCURSOR);
++YYCURSOR;
YYDEBUG(782, *YYCURSOR);
-#line 1479 "parse_date.re"
+#line 1503 "parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -12856,7 +12880,7 @@ yy781:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 12860 "<stdout>"
+#line 12884 "<stdout>"
yy783:
YYDEBUG(783, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12926,7 +12950,7 @@ yy785:
}
yy786:
YYDEBUG(786, *YYCURSOR);
-#line 1465 "parse_date.re"
+#line 1489 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -12939,7 +12963,7 @@ yy786:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 12943 "<stdout>"
+#line 12967 "<stdout>"
yy787:
YYDEBUG(787, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13042,7 +13066,7 @@ yy806:
++YYCURSOR;
yy807:
YYDEBUG(807, *YYCURSOR);
-#line 1439 "parse_date.re"
+#line 1463 "parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13067,7 +13091,7 @@ yy807:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 13071 "<stdout>"
+#line 13095 "<stdout>"
yy808:
YYDEBUG(808, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13362,7 +13386,7 @@ yy812:
}
yy813:
YYDEBUG(813, *YYCURSOR);
-#line 1427 "parse_date.re"
+#line 1451 "parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -13373,7 +13397,7 @@ yy813:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 13377 "<stdout>"
+#line 13401 "<stdout>"
yy814:
YYDEBUG(814, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14292,7 +14316,7 @@ yy937:
if (yych <= '9') goto yy960;
yy938:
YYDEBUG(938, *YYCURSOR);
-#line 1304 "parse_date.re"
+#line 1328 "parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14305,7 +14329,7 @@ yy938:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 14309 "<stdout>"
+#line 14333 "<stdout>"
yy939:
YYDEBUG(939, *YYCURSOR);
yyaccept = 21;
@@ -15398,7 +15422,7 @@ yy1030:
}
yy1032:
YYDEBUG(1032, *YYCURSOR);
-#line 1196 "parse_date.re"
+#line 1220 "parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15420,7 +15444,7 @@ yy1032:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 15424 "<stdout>"
+#line 15448 "<stdout>"
yy1033:
YYDEBUG(1033, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15518,7 +15542,7 @@ yy1039:
}
yy1040:
YYDEBUG(1040, *YYCURSOR);
-#line 1242 "parse_date.re"
+#line 1266 "parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -15537,7 +15561,7 @@ yy1040:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 15541 "<stdout>"
+#line 15565 "<stdout>"
yy1041:
YYDEBUG(1041, *YYCURSOR);
yyaccept = 24;
@@ -16513,7 +16537,7 @@ yy1083:
}
yy1084:
YYDEBUG(1084, *YYCURSOR);
-#line 1638 "parse_date.re"
+#line 1662 "parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16529,7 +16553,7 @@ yy1084:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16533 "<stdout>"
+#line 16557 "<stdout>"
yy1085:
YYDEBUG(1085, *YYCURSOR);
++YYCURSOR;
@@ -16580,7 +16604,7 @@ yy1092:
YYDEBUG(1092, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1093, *YYCURSOR);
-#line 1111 "parse_date.re"
+#line 1135 "parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16601,7 +16625,7 @@ yy1092:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
-#line 16605 "<stdout>"
+#line 16629 "<stdout>"
yy1094:
YYDEBUG(1094, *YYCURSOR);
yyaccept = 25;
@@ -16709,7 +16733,7 @@ yy1107:
}
yy1108:
YYDEBUG(1108, *YYCURSOR);
-#line 1614 "parse_date.re"
+#line 1638 "parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16732,7 +16756,7 @@ yy1108:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16736 "<stdout>"
+#line 16760 "<stdout>"
yy1109:
YYDEBUG(1109, *YYCURSOR);
yych = *++YYCURSOR;
@@ -19567,7 +19591,7 @@ yy1283:
goto yy1287;
yy1284:
YYDEBUG(1284, *YYCURSOR);
-#line 1088 "parse_date.re"
+#line 1112 "parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -19589,7 +19613,7 @@ yy1284:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 19593 "<stdout>"
+#line 19617 "<stdout>"
yy1285:
YYDEBUG(1285, *YYCURSOR);
yyaccept = 27;
@@ -19850,7 +19874,7 @@ yy1305:
YYDEBUG(1305, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1306, *YYCURSOR);
-#line 1071 "parse_date.re"
+#line 1095 "parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -19866,7 +19890,7 @@ yy1305:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 19870 "<stdout>"
+#line 19894 "<stdout>"
yy1307:
YYDEBUG(1307, *YYCURSOR);
yyaccept = 0;
@@ -21299,7 +21323,7 @@ yy1375:
if (yych <= '9') goto yy1375;
yy1377:
YYDEBUG(1377, *YYCURSOR);
-#line 1017 "parse_date.re"
+#line 1041 "parse_date.re"
{
timelib_ull i;
@@ -21324,7 +21348,7 @@ yy1377:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21328 "<stdout>"
+#line 21352 "<stdout>"
yy1378:
YYDEBUG(1378, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21353,7 +21377,7 @@ yy1378:
YYDEBUG(1384, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1385, *YYCURSOR);
-#line 1043 "parse_date.re"
+#line 1067 "parse_date.re"
{
timelib_ull i, us;
@@ -21380,7 +21404,7 @@ yy1378:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21384 "<stdout>"
+#line 21408 "<stdout>"
yy1386:
YYDEBUG(1386, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21816,7 +21840,7 @@ yy1414:
++YYCURSOR;
yy1415:
YYDEBUG(1415, *YYCURSOR);
-#line 1005 "parse_date.re"
+#line 1029 "parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21827,7 +21851,7 @@ yy1415:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21831 "<stdout>"
+#line 21855 "<stdout>"
yy1416:
YYDEBUG(1416, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21862,7 +21886,7 @@ yy1417:
}
yy1418:
YYDEBUG(1418, *YYCURSOR);
-#line 995 "parse_date.re"
+#line 1019 "parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -21871,7 +21895,7 @@ yy1418:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21875 "<stdout>"
+#line 21899 "<stdout>"
yy1419:
YYDEBUG(1419, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23883,7 +23907,7 @@ yy1497:
}
yy1498:
YYDEBUG(1498, *YYCURSOR);
-#line 974 "parse_date.re"
+#line 998 "parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -23891,7 +23915,7 @@ yy1498:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 23895 "<stdout>"
+#line 23919 "<stdout>"
yy1499:
YYDEBUG(1499, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24030,7 +24054,7 @@ yy1505:
}
yy1506:
YYDEBUG(1506, *YYCURSOR);
-#line 983 "parse_date.re"
+#line 1007 "parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -24041,7 +24065,7 @@ yy1506:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24045 "<stdout>"
+#line 24069 "<stdout>"
yy1507:
YYDEBUG(1507, *YYCURSOR);
yyaccept = 0;
@@ -24574,7 +24598,7 @@ yy1528:
++YYCURSOR;
yy1529:
YYDEBUG(1529, *YYCURSOR);
-#line 962 "parse_date.re"
+#line 986 "parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -24585,7 +24609,7 @@ yy1529:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24589 "<stdout>"
+#line 24613 "<stdout>"
yy1530:
YYDEBUG(1530, *YYCURSOR);
yyaccept = 0;
@@ -24758,7 +24782,7 @@ yy1535:
goto yy1529;
}
}
-#line 1764 "parse_date.re"
+#line 1788 "parse_date.re"
}
diff --git a/src/third_party/timelib-2017.05beta5/parse_date.re b/src/third_party/timelib-2017.05beta6/parse_date.re
index a7c599db15d..2fef084ba00 100644
--- a/src/third_party/timelib-2017.05beta5/parse_date.re
+++ b/src/third_party/timelib-2017.05beta6/parse_date.re
@@ -41,18 +41,6 @@
# endif
#endif
-#define TIMELIB_UNSET -99999
-
-#define TIMELIB_SECOND 1
-#define TIMELIB_MINUTE 2
-#define TIMELIB_HOUR 3
-#define TIMELIB_DAY 4
-#define TIMELIB_MONTH 5
-#define TIMELIB_YEAR 6
-#define TIMELIB_WEEKDAY 7
-#define TIMELIB_SPECIAL 8
-#define TIMELIB_MICROSEC 9
-
#define EOI 257
#define TIME 258
#define DATE 259
@@ -713,7 +701,7 @@ static const timelib_tz_lookup_table* abbr_search(const char *word, timelib_long
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
- if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
+ if (fmp->gmtoffset == gmtoffset && fmp->type == isdst) {
return fmp;
}
}
@@ -735,9 +723,9 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
memcpy(word, begin, end - begin);
if ((tp = abbr_search(word, -1, 0))) {
- value = -tp->gmtoffset / 60;
+ value = tp->gmtoffset;
*dst = tp->type;
- value += tp->type * 60;
+ value -= tp->type * 3600;
*found = 1;
} else {
*found = 0;
@@ -747,7 +735,43 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
return value;
}
-timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
+#define sHOUR(a) (int)(a * 3600)
+#define sMIN(a) (int)(a * 60)
+
+static timelib_long timelib_parse_tz_cor(char **ptr)
+{
+ char *begin = *ptr, *end;
+ timelib_long tmp;
+
+ while (isdigit(**ptr) || **ptr == ':') {
+ ++*ptr;
+ }
+ end = *ptr;
+ switch (end - begin) {
+ case 1: /* H */
+ case 2: /* HH */
+ return sHOUR(strtol(begin, NULL, 10));
+ break;
+ case 3: /* H:M */
+ case 4: /* H:MM, HH:M, HHMM */
+ if (begin[1] == ':') {
+ tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 2, NULL, 10));
+ return tmp;
+ } else if (begin[2] == ':') {
+ tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
+ return tmp;
+ } else {
+ tmp = strtol(begin, NULL, 10);
+ return sHOUR(tmp / 100) + sMIN(tmp % 100);
+ }
+ case 5: /* HH:MM */
+ tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
+ return tmp;
+ }
+ return 0;
+}
+
+static timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
{
timelib_tzinfo *res;
timelib_long retval = 0;
@@ -767,7 +791,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
*tz_not_found = 0;
t->dst = 0;
- retval = -1 * timelib_parse_tz_cor(ptr);
+ retval = timelib_parse_tz_cor(ptr);
} else if (**ptr == '-') {
++*ptr;
t->is_localtime = 1;
@@ -775,7 +799,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
*tz_not_found = 0;
t->dst = 0;
- retval = timelib_parse_tz_cor(ptr);
+ retval = -1 * timelib_parse_tz_cor(ptr);
} else {
int found = 0;
timelib_long offset = 0;
diff --git a/src/third_party/timelib-2017.05beta5/parse_iso_intervals.c b/src/third_party/timelib-2017.05beta6/parse_iso_intervals.c
index aa2723a15b0..91ebf9dbbb6 100644
--- a/src/third_party/timelib-2017.05beta5/parse_iso_intervals.c
+++ b/src/third_party/timelib-2017.05beta6/parse_iso_intervals.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.15.3 on Thu Jul 13 17:00:36 2017 */
+/* Generated by re2c 0.15.3 on Thu Jul 27 12:07:30 2017 */
#line 1 "parse_iso_intervals.re"
/*
* The MIT License (MIT)
@@ -41,15 +41,6 @@
# endif
#endif
-#define TIMELIB_UNSET -99999
-
-#define TIMELIB_SECOND 1
-#define TIMELIB_MINUTE 2
-#define TIMELIB_HOUR 3
-#define TIMELIB_DAY 4
-#define TIMELIB_MONTH 5
-#define TIMELIB_YEAR 6
-
#define EOI 257
#define TIMELIB_PERIOD 260
@@ -185,11 +176,11 @@ static int scan(Scanner *s)
std:
s->tok = cursor;
s->len = 0;
-#line 213 "parse_iso_intervals.re"
+#line 204 "parse_iso_intervals.re"
-#line 193 "<stdout>"
+#line 184 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -258,12 +249,12 @@ std:
if (yych <= '9') goto yy98;
yy3:
YYDEBUG(3, *YYCURSOR);
-#line 326 "parse_iso_intervals.re"
+#line 317 "parse_iso_intervals.re"
{
add_error(s, "Unexpected character");
goto std;
}
-#line 267 "<stdout>"
+#line 258 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yyaccept = 0;
@@ -280,7 +271,7 @@ yy5:
if (yych == 'T') goto yy14;
yy6:
YYDEBUG(6, *YYCURSOR);
-#line 253 "parse_iso_intervals.re"
+#line 244 "parse_iso_intervals.re"
{
timelib_sll nr;
int in_time = 0;
@@ -321,26 +312,26 @@ yy6:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
-#line 325 "<stdout>"
+#line 316 "<stdout>"
yy7:
YYDEBUG(7, *YYCURSOR);
++YYCURSOR;
YYDEBUG(8, *YYCURSOR);
-#line 315 "parse_iso_intervals.re"
+#line 306 "parse_iso_intervals.re"
{
goto std;
}
-#line 334 "<stdout>"
+#line 325 "<stdout>"
yy9:
YYDEBUG(9, *YYCURSOR);
++YYCURSOR;
YYDEBUG(10, *YYCURSOR);
-#line 320 "parse_iso_intervals.re"
+#line 311 "parse_iso_intervals.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 344 "<stdout>"
+#line 335 "<stdout>"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
@@ -670,7 +661,7 @@ yy51:
YYDEBUG(57, *YYCURSOR);
++YYCURSOR;
YYDEBUG(58, *YYCURSOR);
-#line 295 "parse_iso_intervals.re"
+#line 286 "parse_iso_intervals.re"
{
DEBUG_OUTPUT("combinedrep");
TIMELIB_INIT;
@@ -689,7 +680,7 @@ yy51:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
-#line 693 "<stdout>"
+#line 684 "<stdout>"
yy59:
YYDEBUG(59, *YYCURSOR);
yych = *++YYCURSOR;
@@ -818,7 +809,7 @@ yy83:
YYDEBUG(83, *YYCURSOR);
++YYCURSOR;
YYDEBUG(84, *YYCURSOR);
-#line 229 "parse_iso_intervals.re"
+#line 220 "parse_iso_intervals.re"
{
timelib_time *current;
@@ -841,7 +832,7 @@ yy83:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 845 "<stdout>"
+#line 836 "<stdout>"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
@@ -919,7 +910,7 @@ yy98:
if (yych <= '9') goto yy98;
yy100:
YYDEBUG(100, *YYCURSOR);
-#line 218 "parse_iso_intervals.re"
+#line 209 "parse_iso_intervals.re"
{
DEBUG_OUTPUT("recurrences");
TIMELIB_INIT;
@@ -929,9 +920,9 @@ yy100:
s->have_recurrences = 1;
return TIMELIB_PERIOD;
}
-#line 933 "<stdout>"
+#line 924 "<stdout>"
}
-#line 330 "parse_iso_intervals.re"
+#line 321 "parse_iso_intervals.re"
}
#ifdef PHP_WIN32
diff --git a/src/third_party/timelib-2017.05beta5/parse_iso_intervals.re b/src/third_party/timelib-2017.05beta6/parse_iso_intervals.re
index 5748383c9b9..7a481c836d1 100644
--- a/src/third_party/timelib-2017.05beta5/parse_iso_intervals.re
+++ b/src/third_party/timelib-2017.05beta6/parse_iso_intervals.re
@@ -39,15 +39,6 @@
# endif
#endif
-#define TIMELIB_UNSET -99999
-
-#define TIMELIB_SECOND 1
-#define TIMELIB_MINUTE 2
-#define TIMELIB_HOUR 3
-#define TIMELIB_DAY 4
-#define TIMELIB_MONTH 5
-#define TIMELIB_YEAR 6
-
#define EOI 257
#define TIMELIB_PERIOD 260
diff --git a/src/third_party/timelib-2017.05beta5/parse_tz.c b/src/third_party/timelib-2017.05beta6/parse_tz.c
index 925e2b539ec..f3e49cb4694 100644
--- a/src/third_party/timelib-2017.05beta5/parse_tz.c
+++ b/src/third_party/timelib-2017.05beta6/parse_tz.c
@@ -146,7 +146,7 @@ static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
*tzf += sizeof(buffer);
}
-static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
+static void skip_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
if (tz->bit64.timecnt) {
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
@@ -154,7 +154,7 @@ static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *t
}
}
-static int read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
+static int read_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
{
int32_t *buffer = NULL;
uint32_t i;
@@ -463,6 +463,15 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
*tzf += sizeof(buffer);
}
+static timelib_tzinfo* timelib_tzinfo_ctor(char *name)
+{
+ timelib_tzinfo *t;
+ t = timelib_calloc(1, sizeof(timelib_tzinfo));
+ t->name = timelib_strdup(name);
+
+ return t;
+}
+
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code)
{
const unsigned char *tzf;
@@ -483,7 +492,7 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
//printf("- timezone: %s, version: %0d\n", timezone, version);
read_header(&tzf, tmp);
- if ((transitions_result = read_transistions(&tzf, tmp)) != 0) {
+ if ((transitions_result = read_transitions(&tzf, tmp)) != 0) {
/* Corrupt file as transitions do not increase */
*error_code = transitions_result;
timelib_tzinfo_dtor(tmp);
@@ -501,7 +510,7 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
return NULL;
}
read_64bit_header(&tzf, tmp);
- skip_64bit_transistions(&tzf, tmp);
+ skip_64bit_transitions(&tzf, tmp);
skip_64bit_types(&tzf, tmp);
skip_posix_string(&tzf, tmp);
}
@@ -519,6 +528,50 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
return tmp;
}
+void timelib_tzinfo_dtor(timelib_tzinfo *tz)
+{
+ TIMELIB_TIME_FREE(tz->name);
+ TIMELIB_TIME_FREE(tz->trans);
+ TIMELIB_TIME_FREE(tz->trans_idx);
+ TIMELIB_TIME_FREE(tz->type);
+ TIMELIB_TIME_FREE(tz->timezone_abbr);
+ TIMELIB_TIME_FREE(tz->leap_times);
+ TIMELIB_TIME_FREE(tz->location.comments);
+ TIMELIB_TIME_FREE(tz);
+ tz = NULL;
+}
+
+timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
+{
+ timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
+ tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
+ tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
+ tmp->bit32.leapcnt = tz->bit32.leapcnt;
+ tmp->bit32.timecnt = tz->bit32.timecnt;
+ tmp->bit32.typecnt = tz->bit32.typecnt;
+ tmp->bit32.charcnt = tz->bit32.charcnt;
+
+ if (tz->bit32.timecnt) {
+ tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
+ tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
+ memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
+ memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
+ }
+
+ tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
+ memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
+
+ tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
+ memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
+
+ if (tz->bit32.leapcnt) {
+ tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
+ memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
+ }
+
+ return tmp;
+}
+
static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time)
{
uint32_t i;
@@ -597,18 +650,18 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
int32_t offset = 0, leap_secs = 0;
char *abbr;
timelib_time_offset *tmp = timelib_time_offset_ctor();
- timelib_sll transistion_time;
+ timelib_sll transition_time;
- if ((to = fetch_timezone_offset(tz, ts, &transistion_time))) {
+ if ((to = fetch_timezone_offset(tz, ts, &transition_time))) {
offset = to->offset;
abbr = &(tz->timezone_abbr[to->abbr_idx]);
tmp->is_dst = to->isdst;
- tmp->transistion_time = transistion_time;
+ tmp->transition_time = transition_time;
} else {
offset = 0;
abbr = tz->timezone_abbr;
tmp->is_dst = 0;
- tmp->transistion_time = 0;
+ tmp->transition_time = 0;
}
if ((tl = fetch_leaptime_offset(tz, ts))) {
@@ -630,7 +683,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
switch (t->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_OFFSET:
- return (t->z + t->dst) * -60;
+ return t->z + (t->dst * 3600);
case TIMELIB_ZONETYPE_ID:
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
diff --git a/src/third_party/timelib-2017.05beta5/parse_zoneinfo.c b/src/third_party/timelib-2017.05beta6/parse_zoneinfo.c
index 7ff88fbb766..7ff88fbb766 100644
--- a/src/third_party/timelib-2017.05beta5/parse_zoneinfo.c
+++ b/src/third_party/timelib-2017.05beta6/parse_zoneinfo.c
diff --git a/src/third_party/timelib-2017.05beta5/timelib.c b/src/third_party/timelib-2017.05beta6/timelib.c
index ea932e2e558..ee52de77cbe 100644
--- a/src/third_party/timelib-2017.05beta5/timelib.c
+++ b/src/third_party/timelib-2017.05beta6/timelib.c
@@ -27,16 +27,8 @@
#include <ctype.h>
#include <math.h>
-#define TIMELIB_TIME_FREE(m) \
- if (m) { \
- timelib_free(m); \
- m = NULL; \
- } \
-
#define TIMELIB_LLABS(y) (y < 0 ? (y * -1) : y)
-#define HOUR(a) (int)(a * 60)
-
const char *timelib_error_messages[8] = {
"No error",
"Can not allocate buffer for parsing",
@@ -65,12 +57,23 @@ timelib_time* timelib_time_ctor(void)
return t;
}
-timelib_rel_time* timelib_rel_time_ctor(void)
+void timelib_time_dtor(timelib_time* t)
{
- timelib_rel_time *t;
- t = timelib_calloc(1, sizeof(timelib_rel_time));
+ TIMELIB_TIME_FREE(t->tz_abbr);
+ TIMELIB_TIME_FREE(t);
+}
- return t;
+int timelib_time_compare(timelib_time *t1, timelib_time *t2)
+{
+ if (t1->sse == t2->sse) {
+ if (t1->us == t2->us) {
+ return 0;
+ }
+
+ return (t1->us < t2->us) ? -1 : 1;
+ }
+
+ return (t1->sse < t2->sse) ? -1 : 1;
}
timelib_time* timelib_time_clone(timelib_time *orig)
@@ -86,17 +89,17 @@ timelib_time* timelib_time_clone(timelib_time *orig)
return tmp;
}
-int timelib_time_compare(timelib_time *t1, timelib_time *t2)
+timelib_rel_time* timelib_rel_time_ctor(void)
{
- if (t1->sse == t2->sse) {
- if (t1->us == t2->us) {
- return 0;
- }
+ timelib_rel_time *t;
+ t = timelib_calloc(1, sizeof(timelib_rel_time));
- return (t1->us < t2->us) ? -1 : 1;
- }
+ return t;
+}
- return (t1->sse < t2->sse) ? -1 : 1;
+void timelib_rel_time_dtor(timelib_rel_time* t)
+{
+ TIMELIB_TIME_FREE(t);
}
timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
@@ -118,17 +121,6 @@ void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
}
}
-void timelib_time_dtor(timelib_time* t)
-{
- TIMELIB_TIME_FREE(t->tz_abbr);
- TIMELIB_TIME_FREE(t);
-}
-
-void timelib_rel_time_dtor(timelib_rel_time* t)
-{
- TIMELIB_TIME_FREE(t);
-}
-
timelib_time_offset* timelib_time_offset_ctor(void)
{
timelib_time_offset *t;
@@ -143,59 +135,6 @@ void timelib_time_offset_dtor(timelib_time_offset* t)
TIMELIB_TIME_FREE(t);
}
-timelib_tzinfo* timelib_tzinfo_ctor(char *name)
-{
- timelib_tzinfo *t;
- t = timelib_calloc(1, sizeof(timelib_tzinfo));
- t->name = timelib_strdup(name);
-
- return t;
-}
-
-timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
-{
- timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
- tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
- tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
- tmp->bit32.leapcnt = tz->bit32.leapcnt;
- tmp->bit32.timecnt = tz->bit32.timecnt;
- tmp->bit32.typecnt = tz->bit32.typecnt;
- tmp->bit32.charcnt = tz->bit32.charcnt;
-
- if (tz->bit32.timecnt) {
- tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
- tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
- memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
- memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
- }
-
- tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
- memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
-
- tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
- memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
-
- if (tz->bit32.leapcnt) {
- tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
- memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
- }
-
- return tmp;
-}
-
-void timelib_tzinfo_dtor(timelib_tzinfo *tz)
-{
- TIMELIB_TIME_FREE(tz->name);
- TIMELIB_TIME_FREE(tz->trans);
- TIMELIB_TIME_FREE(tz->trans_idx);
- TIMELIB_TIME_FREE(tz->type);
- TIMELIB_TIME_FREE(tz->timezone_abbr);
- TIMELIB_TIME_FREE(tz->leap_times);
- TIMELIB_TIME_FREE(tz->location.comments);
- TIMELIB_TIME_FREE(tz);
- tz = NULL;
-}
-
char *timelib_get_tz_abbr_ptr(timelib_time *t)
{
if (!t->sse_uptodate) {
@@ -239,9 +178,24 @@ timelib_long timelib_date_to_int(timelib_time *d, int *error)
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
{
- *hour = floor(h);
- *min = floor((h - *hour) * 60);
- *sec = (h - *hour - ((float) *min / 60)) * 3600;
+ if (h > 0) {
+ *hour = floor(h);
+ *min = floor((h - *hour) * 60);
+ *sec = (h - *hour - ((float) *min / 60)) * 3600;
+ } else {
+ *hour = ceil(h);
+ *min = 0 - ceil((h - *hour) * 60);
+ *sec = 0 - (h - *hour - ((float) *min / -60)) * 3600;
+ }
+}
+
+void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h)
+{
+ if (hour > 0) {
+ *h = ((double)hour + (double)min / 60 + (double)sec / 3600);
+ } else {
+ *h = ((double)hour - (double)min / 60 - (double)sec / 3600);
+ }
}
void timelib_dump_date(timelib_time *d, int options)
@@ -331,36 +285,3 @@ void timelib_dump_rel_time(timelib_rel_time *d)
}
printf("\n");
}
-
-timelib_long timelib_parse_tz_cor(char **ptr)
-{
- char *begin = *ptr, *end;
- timelib_long tmp;
-
- while (isdigit(**ptr) || **ptr == ':') {
- ++*ptr;
- }
- end = *ptr;
- switch (end - begin) {
- case 1: /* H */
- case 2: /* HH */
- return HOUR(strtol(begin, NULL, 10));
- break;
- case 3: /* H:M */
- case 4: /* H:MM, HH:M, HHMM */
- if (begin[1] == ':') {
- tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 2, NULL, 10);
- return tmp;
- } else if (begin[2] == ':') {
- tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
- return tmp;
- } else {
- tmp = strtol(begin, NULL, 10);
- return HOUR(tmp / 100) + tmp % 100;
- }
- case 5: /* HH:MM */
- tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
- return tmp;
- }
- return 0;
-}
diff --git a/src/third_party/timelib-2017.05beta6/timelib.h b/src/third_party/timelib-2017.05beta6/timelib.h
new file mode 100644
index 00000000000..cef78122051
--- /dev/null
+++ b/src/third_party/timelib-2017.05beta6/timelib.h
@@ -0,0 +1,871 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Derick Rethans
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __TIMELIB_H__
+#define __TIMELIB_H__
+
+#ifdef HAVE_TIMELIB_CONFIG_H
+# include "timelib_config.h"
+#endif
+
+#include <stdlib.h>
+#include <limits.h>
+#include <inttypes.h>
+
+# ifndef HAVE_INT32_T
+# if SIZEOF_INT == 4
+typedef int int32_t;
+# elif SIZEOF_LONG == 4
+typedef long int int32_t;
+# endif
+# endif
+
+# ifndef HAVE_UINT32_T
+# if SIZEOF_INT == 4
+typedef unsigned int uint32_t;
+# elif SIZEOF_LONG == 4
+typedef unsigned long int uint32_t;
+# endif
+# endif
+
+#ifdef _WIN32
+# if _MSC_VER >= 1600
+# include <stdint.h>
+# endif
+# ifndef SIZEOF_INT
+# define SIZEOF_INT 4
+# endif
+# ifndef SIZEOF_LONG
+# define SIZEOF_LONG 4
+# endif
+# ifndef int32_t
+typedef __int32 int32_t;
+# endif
+# ifndef uint32_t
+typedef unsigned __int32 uint32_t;
+# endif
+# ifndef int64_t
+typedef __int64 int64_t;
+# endif
+# ifndef uint64_t
+typedef unsigned __int64 uint64_t;
+# endif
+# ifndef PRId32
+# define PRId32 "I32d"
+# endif
+# ifndef PRIu32
+# define PRIu32 "I32u"
+# endif
+# ifndef PRId64
+# define PRId64 "I64d"
+# endif
+# ifndef PRIu64
+# define PRIu64 "I64u"
+# endif
+# ifndef INT32_MAX
+#define INT32_MAX _I32_MAX
+# endif
+# ifndef INT32_MIN
+#define INT32_MIN ((int32_t)_I32_MIN)
+# endif
+# ifndef UINT32_MAX
+#define UINT32_MAX _UI32_MAX
+# endif
+# ifndef INT64_MIN
+#define INT64_MIN ((int64_t)_I64_MIN)
+# endif
+# ifndef INT64_MAX
+#define INT64_MAX _I64_MAX
+# endif
+# ifndef UINT64_MAX
+#define UINT64_MAX _UI64_MAX
+# endif
+#endif
+
+#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
+typedef int64_t timelib_long;
+typedef uint64_t timelib_ulong;
+# define TIMELIB_LONG_MAX INT64_MAX
+# define TIMELIB_LONG_MIN INT64_MIN
+# define TIMELIB_ULONG_MAX UINT64_MAX
+# define TIMELIB_LONG_FMT "%" PRId64
+# define TIMELIB_ULONG_FMT "%" PRIu64
+#else
+typedef int32_t timelib_long;
+typedef uint32_t timelib_ulong;
+# define TIMELIB_LONG_MAX INT32_MAX
+# define TIMELIB_LONG_MIN INT32_MIN
+# define TIMELIB_ULONG_MAX UINT32_MAX
+# define TIMELIB_LONG_FMT "%" PRId32
+# define TIMELIB_ULONG_FMT "%" PRIu32
+#endif
+
+#if defined(_MSC_VER)
+typedef uint64_t timelib_ull;
+typedef int64_t timelib_sll;
+# define TIMELIB_LL_CONST(n) n ## i64
+#else
+typedef unsigned long long timelib_ull;
+typedef signed long long timelib_sll;
+# define TIMELIB_LL_CONST(n) n ## ll
+#endif
+
+typedef struct ttinfo ttinfo;
+typedef struct tlinfo tlinfo;
+
+typedef struct tlocinfo
+{
+ char country_code[3];
+ double latitude;
+ double longitude;
+ char *comments;
+} tlocinfo;
+
+typedef struct timelib_tzinfo
+{
+ char *name;
+ struct {
+ uint32_t ttisgmtcnt;
+ uint32_t ttisstdcnt;
+ uint32_t leapcnt;
+ uint32_t timecnt;
+ uint32_t typecnt;
+ uint32_t charcnt;
+ } bit32;
+ struct {
+ uint64_t ttisgmtcnt;
+ uint64_t ttisstdcnt;
+ uint64_t leapcnt;
+ uint64_t timecnt;
+ uint64_t typecnt;
+ uint64_t charcnt;
+ } bit64;
+
+ int32_t *trans;
+ unsigned char *trans_idx;
+
+ ttinfo *type;
+ char *timezone_abbr;
+
+ tlinfo *leap_times;
+ unsigned char bc;
+ tlocinfo location;
+} timelib_tzinfo;
+
+typedef struct timelib_rel_time {
+ timelib_sll y, m, d; /* Years, Months and Days */
+ timelib_sll h, i, s; /* Hours, mInutes and Seconds */
+ timelib_sll us; /* Microseconds */
+
+ int weekday; /* Stores the day in 'next monday' */
+ int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
+
+ int first_last_day_of;
+ int invert; /* Whether the difference should be inverted */
+ timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
+
+ struct {
+ unsigned int type;
+ timelib_sll amount;
+ } special;
+
+ unsigned int have_weekday_relative, have_special_relative;
+} timelib_rel_time;
+
+typedef struct timelib_time_offset {
+ int32_t offset;
+ unsigned int leap_secs;
+ unsigned int is_dst;
+ char *abbr;
+ timelib_sll transition_time;
+} timelib_time_offset;
+
+typedef struct timelib_time {
+ timelib_sll y, m, d; /* Year, Month, Day */
+ timelib_sll h, i, s; /* Hour, mInute, Second */
+ timelib_sll us; /* Microseconds */
+ int z; /* UTC offset in seconds */
+ char *tz_abbr; /* Timezone abbreviation (display only) */
+ timelib_tzinfo *tz_info; /* Timezone structure */
+ signed int dst; /* Flag if we were parsing a DST zone */
+ timelib_rel_time relative;
+
+ timelib_sll sse; /* Seconds since epoch */
+
+ unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
+
+ unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
+ unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
+ unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
+ unsigned int zone_type; /* 1 time offset,
+ * 3 TimeZone identifier,
+ * 2 TimeZone abbreviation */
+} timelib_time;
+
+typedef struct timelib_abbr_info {
+ timelib_sll utc_offset;
+ char *abbr;
+ int dst;
+} timelib_abbr_info;
+
+#define TIMELIB_WARN_MASK 0x1ff
+#define TIMELIB_ERR_MASK 0x2ff
+
+#define TIMELIB_WARN_DOUBLE_TZ 0x101
+#define TIMELIB_WARN_INVALID_TIME 0x102
+#define TIMELIB_WARN_INVALID_DATE 0x103
+#define TIMELIB_WARN_TRAILING_DATA 0x11a
+
+#define TIMELIB_ERR_DOUBLE_TZ 0x201
+#define TIMELIB_ERR_TZID_NOT_FOUND 0x202
+#define TIMELIB_ERR_DOUBLE_TIME 0x203
+#define TIMELIB_ERR_DOUBLE_DATE 0x204
+#define TIMELIB_ERR_UNEXPECTED_CHARACTER 0x205
+#define TIMELIB_ERR_EMPTY_STRING 0x206
+#define TIMELIB_ERR_UNEXPECTED_DATA 0x207
+#define TIMELIB_ERR_NO_TEXTUAL_DAY 0x208
+#define TIMELIB_ERR_NO_TWO_DIGIT_DAY 0x209
+#define TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR 0x20a
+#define TIMELIB_ERR_NO_TWO_DIGIT_MONTH 0x20b
+#define TIMELIB_ERR_NO_TEXTUAL_MONTH 0x20c
+#define TIMELIB_ERR_NO_TWO_DIGIT_YEAR 0x20d
+#define TIMELIB_ERR_NO_FOUR_DIGIT_YEAR 0x20e
+#define TIMELIB_ERR_NO_TWO_DIGIT_HOUR 0x20f
+#define TIMELIB_ERR_HOUR_LARGER_THAN_12 0x210
+#define TIMELIB_ERR_MERIDIAN_BEFORE_HOUR 0x211
+#define TIMELIB_ERR_NO_MERIDIAN 0x212
+#define TIMELIB_ERR_NO_TWO_DIGIT_MINUTE 0x213
+#define TIMELIB_ERR_NO_TWO_DIGIT_SECOND 0x214
+#define TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND 0x215
+#define TIMELIB_ERR_NO_SEP_SYMBOL 0x216
+#define TIMELIB_ERR_EXPECTED_ESCAPE_CHAR 0x217
+#define TIMELIB_ERR_NO_ESCAPED_CHAR 0x218
+#define TIMELIB_ERR_WRONG_FORMAT_SEP 0x219
+#define TIMELIB_ERR_TRAILING_DATA 0x21a
+#define TIMELIB_ERR_DATA_MISSING 0x21b
+
+
+
+
+typedef struct timelib_error_message {
+ int error_code;
+ int position;
+ char character;
+ char *message;
+} timelib_error_message;
+
+typedef struct timelib_error_container {
+ struct timelib_error_message *error_messages;
+ struct timelib_error_message *warning_messages;
+ int error_count;
+ int warning_count;
+} timelib_error_container;
+
+typedef struct _timelib_tz_lookup_table {
+ char *name;
+ int type;
+ float gmtoffset;
+ char *full_tz_name;
+} timelib_tz_lookup_table;
+
+typedef struct _timelib_tzdb_index_entry {
+ char *id;
+ unsigned int pos;
+} timelib_tzdb_index_entry;
+
+typedef struct _timelib_tzdb {
+ char *version;
+ int index_size;
+ const timelib_tzdb_index_entry *index;
+ const unsigned char *data;
+} timelib_tzdb;
+
+#ifndef timelib_malloc
+# define timelib_malloc malloc
+# define timelib_realloc realloc
+# define timelib_calloc calloc
+# define timelib_strdup strdup
+# define timelib_free free
+#endif
+
+#define TIMELIB_VERSION 201705
+#define TIMELIB_ASCII_VERSION "2017.05beta2"
+
+#define TIMELIB_NONE 0x00
+#define TIMELIB_OVERRIDE_TIME 0x01
+#define TIMELIB_NO_CLONE 0x02
+
+#define TIMELIB_UNSET -99999
+
+/* An entry for each of these error codes is also in the
+ * timelib_error_messages array in timelib.c */
+#define TIMELIB_ERROR_NO_ERROR 0x00
+#define TIMELIB_ERROR_CANNOT_ALLOCATE 0x01
+#define TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE 0x02
+#define TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE 0x03
+#define TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION 0x04
+#define TIMELIB_ERROR_UNSUPPORTED_VERSION 0x05
+#define TIMELIB_ERROR_NO_SUCH_TIMEZONE 0x06
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function pointers */
+typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb, int *error_code);
+
+/* From dow.c */
+/* Calculates the day of the week from y, m, and d. 0=Sunday..6=Saturday */
+timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
+
+/* Calculates the day of the ISO week from y, m, and d. 1=Monday, 7=Sunday */
+timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
+
+/* Calculates the day of the year according to y-m-d. 0=Jan 1st..364/365=Dec
+ * 31st */
+timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d);
+
+/* Calculates the day of the year according to y-w-dow. 0..364/365 */
+timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id);
+
+/* Calculates the number of days in month m for year y. 28..31 */
+timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
+
+/* Calculates the ISO year and week from y, m, and d, into iw and iy */
+void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
+
+/* Calculates the ISO year, week, and day of week from y, m, and d, into iy,
+ * iw, and id */
+void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id);
+
+/* Calculates the year, month, and day from iy, iw, and iw, into y, m, and d */
+void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d);
+
+/* Returns true if h, i and s fit in the range 00:00:00..23:59:59, false
+ * otherwise */
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
+
+/* Returns true if m fits in the range 1..12, and d fits in the range
+ * 1..<days-in-month> for year y */
+int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
+
+/* From parse_date.re */
+
+/* Parses the date/time string in 's' with length 'len' into the constituent
+ * parts of timelib_time*.
+ *
+ * Depending on the contents of the string 's', not all elements might be
+ * filled. You can check whether a specific element has been parsed by
+ * comparing with the TIMELIB_UNSET define.
+ *
+ * If errors occur, this function keeps already parsed elements in the
+ * returned timelib_time* value.
+ *
+ * If the **errors points to a timelib_error_container variable, warnings
+ * and errors will be recorded. You are responsible for freeing the stored
+ * information with timelib_error_container_dtor(). To see whether errors have
+ * occured, inspect errors->errors_count. To see whether warnings have occured,
+ * inspect errors->warnings_count.
+ *
+ * The returned timelib_time* value is dynamically allocated and should be
+ * freed with timelib_time_dtor().
+ */
+timelib_time *timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
+
+/* Parses the date/time string in 's' with length 'len' into the constituent
+ * parts of timelib_time* according to the format in 'format'.
+ *
+ * Depending on the contents of the string 's', not all elements might be
+ * filled. You can check whether a specific element has been parsed by
+ * comparing with the TIMELIB_UNSET define.
+ *
+ * If errors occur, this function keeps already parsed elements in the
+ * returned timelib_time* value.
+ *
+ * If the **errors points to a timelib_error_container variable, warnings
+ * and errors will be recorded. You are responsible for freeing the stored
+ * information with timelib_error_container_dtor(). To see whether errors have
+ * occured, inspect errors->errors_count. To see whether warnings have occured,
+ * inspect errors->warnings_count.
+ *
+ * The returned timelib_time* value is dynamically allocated and should be
+ * freed with timelib_time_dtor().
+ */
+timelib_time *timelib_parse_from_format(char *format, char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
+
+/* Fills the gaps in the parsed timelib_time with information from the reference date/time in 'now'
+ *
+ * If any of the 'parsed' y, m, d, h, i or s parameters is unset (TIMELIB_UNSET):
+ * - if microtime (us) is unset, then the us of the parsed time is set to 0.
+ * - else if microtime (us) is unset and 'now'->'us' is set, use it, otherwise use 0.
+ *
+ * For either of the 'parsed' y, m, d, h, i, s, z (utc offset in seconds) or
+ * dst is unset, set it to the corresponding value in 'now' if set, otherwise
+ * set it to 0.
+ *
+ * It duplicates tz_abbr if unset in 'parsed' but set in 'now'.
+ *
+ * It duplicates tz_info if unset in 'parsed', but set in 'now' unless
+ * TIMELIB_NO_CLONE is passed, in which case only the pointer in 'parsed' is
+ * set to 'now'.
+ *
+ * If the option TIMELIB_OVERRIDE_TIME is passed and the parsed date/time has
+ * no time portion, the function will ignore the time aspect in 'now' and
+ * instead fill it with zeros.
+ */
+void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
+
+/* Tries to convert a time zone abbreviation, gmtoffset and/or isdst flag
+ * combination to a time zone identifier.
+ *
+ * If 'abbr' is either 'utc' or 'gmt' (case insensitve) then "UTC" is
+ * returned.
+ *
+ * It first uses the data in the timezonemap.h file to find a matching
+ * abbreviation/GMT offset combination. If not found, it uses the data in
+ * fallbackmap.h to match only the GMT offset/isdst flag to try to find a
+ * match. If nothing is found, NULL is returned.
+ *
+ * The returned char* is not duplicated, and should not be freed.
+ */
+char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
+
+/* Returns an array of known time zone abbreviations
+ *
+ * This file is generated from the time zone database through the
+ * gettzmapping.php scripts, which requires that an up-to-date time zone
+ * database is used with the PHP binary that runs the script.
+ *
+ * Each item in the returned list contains the abbreviation, a flag whether
+ * it's an abbreviation used with DST, the UTC offset in seconds, and the name
+ * of the time zone identifier that this abbreviation belongs to.
+ *
+ * The order for each specific abbreviation is controlled through the
+ * preference list in the gettzmapping.php script. Time zones that match the
+ * pattern ±\d{2,4} are excluded
+ */
+const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
+
+/* From parse_iso_intervals.re */
+
+/**
+ * Parses a subset of an ISO 8601 intervals specification string into its
+ * constituent parts.
+ *
+ * If the **errors points to a timelib_error_container variable, warnings
+ * and errors will be recorded. You are responsible for freeing the stored
+ * information with timelib_error_container_dtor(). To see whether errors have
+ * occured, inspect errors->errors_count. To see whether warnings have occured,
+ * inspect errors->warnings_count.
+ */
+void timelib_strtointerval(char *s, size_t len,
+ timelib_time **begin, timelib_time **end,
+ timelib_rel_time **period, int *recurrences,
+ struct timelib_error_container **errors);
+
+
+/* From tm2unixtime.c */
+
+/**
+ * Uses the y/m/d/h/i/s fields to calculate and store the equivalent timestamp
+ * in the sse field.
+ *
+ * It uses the time zone information associated with 'time' to account for the
+ * right UTC offset and/or DST rules. You can associate time zone information
+ * with the timelib_set_timezone_* functions (see below).
+ *
+ * If the type is 'TIMELIB_ZONETYPE_ID' and there is no associated tzinfo, it
+ * will use the second argument 'tzi' to provide the rules necessary to
+ * calculate the right timestamp.
+ */
+void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
+
+/**
+ * Takes the information from the y/m/d/h/i/s fields and makes sure their
+ * values are in the right range.
+ *
+ * If a value under- or overflows it will adjust the larger measure up (or
+ * down). It also takes into account leap days.
+ */
+void timelib_do_normalize(timelib_time *base);
+
+/**
+ * Takes the information from the y/m/d/h/i/s fields of 'rt' and makes sure
+ * their values are in the right range.
+ *
+ * If a value under- or overflows it will adjust the larger measure up (or
+ * down). As this function operates on a *relative date/time*, it also takes
+ * into account leap days and correctly accounts for the difference depending
+ * on the base date/time in 'base'.
+ */
+void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt);
+
+/* From unixtime2tm.c */
+
+/**
+ * Takes the unix timestamp in seconds from 'ts' and populates the y/m/d/h/i/s
+ * fields of 'tm' without taking time zones into account
+ */
+void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
+
+/**
+ * Takes the Unix timestamp from 'ts', and calculates the y/m/d/h/i/s fields
+ * according to the time zone information attached to 'tm'.
+ */
+void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
+
+/**
+ * Takes the Unix timestamp stored in 'tm', and calculates the y/m/d/h/i/s
+ * fields according to the time zone information attached to 'tm'.
+ */
+void timelib_update_from_sse(timelib_time *tm);
+
+/**
+ * Attaches the UTC offset as time zone information to 't'.
+ *
+ * 'utc_offset' is in seconds East of UTC.
+ */
+void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
+
+/**
+ * Attaches the information from 'abbr_info' as time zone information to 't'.
+ *
+ * The timelib_abbr_info struct contains an abbreviation ('abbr') which string
+ * value is duplicated, as well as a 'utc_offset' and 'dst' flag. It only
+ * supports a 'dst' change over of 1 hour.
+ */
+void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
+
+/**
+ * Attaches the time zone information in 'tz' to to 't'.
+ *
+ * It fetches the right UTC offset that is currently stored in the time
+ * stamp field in 't' ('sse'), and assigns that to the 'z' field and 'dst'
+ * field (whether DST is in effect at the time). It also sets the current
+ * abbrevation to the 'tz_addr' field, making sure that if a value was already
+ * set it was freed.
+ *
+ * The time zone information in 'tz' is *not* duplicated into the 't' field so
+ * it should not be freed until all timelib_time* variables have been freed as
+ * well.
+ */
+void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
+
+/* From parse_tz.c */
+
+/**
+ * Returns whether the time zone ID 'timezone' is available in the time zone
+ * database as pointed to be 'tzdb'.
+ */
+int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
+
+/**
+ * Converts the binary stored time zone information from 'tzdb' for the time
+ * zone 'timeozne' into a structure the library can use for calculations.
+ *
+ * The function can be used on both timelib_builtin_db as well as a time zone
+ * db as opened by timelib_zoneinfo.
+ * The function will return null upon failure, and also set an error code
+ * through 'error_code'. 'error_code' must not be a null pointer. The error
+ * code is one of the TIMELIB_ERROR_* constants as listed above. These error
+ * constants can be converted into a string by timelib_get_error_message.
+ *
+ * This function allocates memory for the new time zone structure, which must
+ * be freed after use. Although it is recommended that a cache of each used
+ * time zone is kept.
+ */
+timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code);
+
+/**
+ * Frees up the resources allocated by 'timelib_parse_tzfile'.
+ */
+void timelib_tzinfo_dtor(timelib_tzinfo *tz);
+
+/**
+ * Deep-clones a timelib_tzinfo structure.
+ *
+ * This allocates resources that need to be freed with 'timelib_tzinfo_dtor'
+ */
+timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
+
+/**
+ * Returns whether DST is active with time zone 'tz' for the time stamp 'ts'.
+ *
+ * Returns 0 if DST is not active, 1 if DST is active, or -1 if no transitions
+ * were available through 'tz'.
+ */
+int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
+
+/**
+ * Returns offset information with time zone 'tz' for the time stamp 'ts'.
+ *
+ * The returned information contains: the offset in seconds East of UTC (in
+ * 'offset'), whether DST is active ('is_dst'), what the current time zone
+ * abbreviation is ('abbr') and the transition time that got to this state (in
+ * 'transistion_time');
+ */
+timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
+
+/**
+ * Returns the UTC offset currently applicable for the information stored in 't'.
+ *
+ * The value returned is the UTC offset in seconds East.
+ */
+timelib_sll timelib_get_current_offset(timelib_time *t);
+
+/**
+ * Displays debugging information about the time zone information in 'tz'.
+ */
+void timelib_dump_tzinfo(timelib_tzinfo *tz);
+
+/**
+ * Returns a pointer to the built-in time zone database.
+ *
+ * You must *not* free the returned pointer as it is part of the text segment.
+ */
+const timelib_tzdb *timelib_builtin_db(void);
+
+/**
+ * Returns a pointer to the start of an array containing a list of timezone identifiers.
+ *
+ * The amount of entries in the array is returned through the 'count' OUT parameter.
+ *
+ * Each entry contains the time zone ID ('id' field), and the position within the time zone
+ * information ('pos' field). The pos field should not be used.
+ */
+const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count);
+
+/* From parse_zoneinfo.c */
+
+/**
+ * Scans the directory and subdirectories of 'directory' for valid time zone files and builds
+ * a time zone database out of these files.
+ *
+ * Typically, the directory should point to '/usr/share/zoneinfo'.
+ *
+ * Unlike 'timelib_builtin_db', the return value of this function must be freed
+ * with the 'timelib_zoneinfo_dtor' function.
+ */
+timelib_tzdb *timelib_zoneinfo(char *directory);
+
+/**
+ * Frees up the resources as created through 'timelib_zoneinfo'.
+ *
+ * This function must be used to free up all the resources that have been
+ * allocated while calling 'timelib_zoneinfo'.
+ */
+void timelib_zoneinfo_dtor(timelib_tzdb *tzdb);
+
+/* From timelib.c */
+
+/**
+ * Returns a static string containing an error message belonging to a specific
+ * error code.
+ */
+const char *timelib_get_error_message(int error_code);
+
+/**
+ * Allocates resources for the relative time structure.
+ *
+ * Must be freed with 'timelib_rel_time_dtor'.
+ */
+timelib_rel_time* timelib_rel_time_ctor(void);
+
+/**
+ * Frees up the resources as allocated through 'timelib_rel_time_ctor'.
+ */
+void timelib_rel_time_dtor(timelib_rel_time* t);
+
+/**
+ * Creates a new timelib_rel_time resource and copies over the information
+ * from 'tz'.
+ *
+ * Must be freed with 'timelib_rel_time_dtor'.
+ */
+timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *tz);
+
+/**
+ * Allocates resources for the time structure.
+ *
+ * Must be freed with 'timelib_time_dtor'.
+ */
+timelib_time* timelib_time_ctor(void);
+
+/**
+ * Frees up the resources as allocated through 'timelib_time_ctor'.
+ */
+void timelib_time_dtor(timelib_time* t);
+
+/**
+ * Creates a new timelib_time resource and copies over the information
+ * from 'orig'.
+ *
+ * Must be freed with 'timelib_time_dtor'.
+ */
+timelib_time* timelib_time_clone(timelib_time* orig);
+
+/**
+ * Compares two timelib_time structures and returns which one is earlier in
+ * time.
+ *
+ * To decide which comes earlier it uses the 'sse' (Seconds Since Epoch) and
+ * 'us' (microseconds) fields.
+ *
+ * Returns -1 if t1 < t2, 0 if t1 == t2, and -1 if t1 > t2.
+ */
+int timelib_time_compare(timelib_time *t1, timelib_time *t2);
+
+/**
+ * Allocates resources for the time offset structure.
+ *
+ * Must be freed with 'timelib_time_offset_dtor'.
+ */
+timelib_time_offset* timelib_time_offset_ctor(void);
+
+/**
+ * Frees up the resources as allocated through 'timelib_time_offset_ctor'.
+ */
+void timelib_time_offset_dtor(timelib_time_offset* t);
+
+/**
+ * Frees up the resources allocated while converting strings to timelib_time
+ * structures with the timelib_strtotime and timelib_strtointerval functions.
+ */
+void timelib_error_container_dtor(timelib_error_container *errors);
+
+/**
+ * Converts the 'sse' value of 'd' to a timelib_long type.
+ *
+ * If the value fits in the TIMELIB_LONG_MIN and TIMELIB_LONG_MAX range, the
+ * value is cast to (timelib_long) and returned. If *error is not a NULL
+ * pointer, it will be set to 0.
+ *
+ * If the value does *not* fit in the range, the function returns 0 and if
+ * *error is not a NULL pointer, it will be set to 1.
+ *
+ * timelib_long is a 32 bit signed long integer on 32 bit platforms, and a 64
+ * bit signed long long integer on 64 bit platforms. In other words, it makes
+ * sure that the value in 'sse' (which is always a signed long long 64 bit
+ * integer) can be used safely outside of the library.
+ */
+timelib_long timelib_date_to_int(timelib_time *d, int *error);
+
+/**
+ * Displays debugging information about the date/time information stored in 'd'.
+ *
+ * 'options' is a bit field, where:
+ * - 1 controls whether the relative time portion is shown.
+ * - 2 controls whether the zone type is shown.
+ */
+void timelib_dump_date(timelib_time *d, int options);
+
+/**
+ * Displays debugging information about the relative time information stored
+ * in 'd'.
+ */
+void timelib_dump_rel_time(timelib_rel_time *d);
+
+/**
+ * Converts a decimal hour into hour/min/sec components
+ */
+void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
+
+/**
+ * Converts hour/min/sec values into a decimal hour
+ */
+void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h);
+
+/* from astro.c */
+
+/**
+ * Converts the Unix Epoch time stamp 'ts' to the J2000 epoch
+ *
+ * The value returned is the number of whole days since 2000-01-01T12:00:00
+ * UTC: https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_years_and_J2000
+ */
+double timelib_ts_to_juliandate(timelib_sll ts);
+
+/**
+ * Calculates when the Sun is above a certain latitude.
+ *
+ * Parameters:
+ * - time: A timelib_time time describing that needs to specific midnight for a
+ * specific day.
+ * - lon: The longitude of the observer (East positive, West negative).
+ * - lat: The latitude of the observer (North positive, South negative).
+ * - altit: The altitude. Set to -35/60 for rise/set, -6 for civil twilight,
+ * -12 for nautical, and -18 for astronomical twilight.
+ * - upper_limb: set to non-zero for rise/set calculations, and 0 for twilight
+ * calculations.
+ *
+ * Out Parameters:
+ * - h_rise: The decimal hour when the Sun rises
+ * - h_set: The decimal hour when the Sun sets
+ * - ts_rise: The Unix timestamp of the Sun rising
+ * - ts_set: The Unix timestamp of the Sun setting
+ * - ts_transit: The Unix timestmap of the Sun transitting through South
+ *
+ * Return Values:
+ * - 0: The Sun rises and sets.
+ * - +1: The Sun is always above the horizon. (ts_rise is set to ts_transit -
+ * (12 * 3600); ts_set is set to ts_transit + (12 * 3600).
+ * - -1: The Sun is awlays below the horizon. (ts_rise and ts_set are set
+ * to ts_transit)
+ */
+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);
+
+/* from interval.c */
+
+/**
+ * Calculates the difference between two times
+ *
+ * The result is a timelib_rel_time structure that describes how you can
+ * convert from 'one' to 'two' with 'timelib_add'. This does *not* necessarily
+ * mean that you can go from 'two' to 'one' by using 'timelib_sub' due to the
+ * way months and days are calculated.
+ */
+timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two);
+
+/**
+ * Adds the relative time information 'interval' to the base time 't'.
+ *
+ * This can be a relative time as created by 'timelib_diff', but also by more
+ * complex statements such as "next workday".
+ */
+timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval);
+
+/**
+ * Subtracts the relative time information 'interval' to the base time 't'.
+ *
+ * This can be a relative time as created by 'timelib_diff'. Unlike with
+ * 'timelib_add', this does not support more complex statements such as "next
+ * workday".
+ */
+timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/src/third_party/timelib-2017.05beta5/timelib.m4 b/src/third_party/timelib-2017.05beta6/timelib.m4
index e112380da05..e112380da05 100644
--- a/src/third_party/timelib-2017.05beta5/timelib.m4
+++ b/src/third_party/timelib-2017.05beta6/timelib.m4
diff --git a/src/third_party/timelib-2017.05beta5/timelib_private.h b/src/third_party/timelib-2017.05beta6/timelib_private.h
index c9500cffec8..b81897a3edf 100644
--- a/src/third_party/timelib-2017.05beta5/timelib_private.h
+++ b/src/third_party/timelib-2017.05beta6/timelib_private.h
@@ -73,6 +73,16 @@
#include <limits.h>
#endif
+#define TIMELIB_SECOND 1
+#define TIMELIB_MINUTE 2
+#define TIMELIB_HOUR 3
+#define TIMELIB_DAY 4
+#define TIMELIB_MONTH 5
+#define TIMELIB_YEAR 6
+#define TIMELIB_WEEKDAY 7
+#define TIMELIB_SPECIAL 8
+#define TIMELIB_MICROSEC 9
+
#define TIMELIB_SPECIAL_WEEKDAY 0x01
#define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
#define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
@@ -99,6 +109,12 @@
#define TIMELIB_DEBUG(s) if (0) { s }
+#define TIMELIB_TIME_FREE(m) \
+ if (m) { \
+ timelib_free(m); \
+ m = NULL; \
+ }
+
typedef struct ttinfo
{
int32_t offset;
@@ -132,4 +148,11 @@ typedef struct tlinfo
#define strncasecmp strnicmp
#endif
+/* From unixtime2tm.c */
+int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
+
+/* From parse_tz.c */
+void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
+
+
#endif
diff --git a/src/third_party/timelib-2017.05beta5/timezonedb.h b/src/third_party/timelib-2017.05beta6/timezonedb.h
index 2c63fb1d945..2c63fb1d945 100644
--- a/src/third_party/timelib-2017.05beta5/timezonedb.h
+++ b/src/third_party/timelib-2017.05beta6/timezonedb.h
diff --git a/src/third_party/timelib-2017.05beta5/timezonemap.h b/src/third_party/timelib-2017.05beta6/timezonemap.h
index 181f9592276..5859d22f66a 100644
--- a/src/third_party/timelib-2017.05beta5/timezonemap.h
+++ b/src/third_party/timelib-2017.05beta6/timezonemap.h
@@ -1,101 +1,3 @@
- { "+0020", 0, 1200, "Europe/Amsterdam" },
- { "+0020", 1, 1200, "Africa/Accra" },
- { "+0120", 1, 4800, "Europe/Amsterdam" },
- { "+0130", 0, 5400, "Africa/Windhoek" },
- { "+0220", 0, 8400, "Europe/Zaporozhye" },
- { "+0230", 0, 9000, "Africa/Addis_Ababa" },
- { "+0230", 0, 9000, "Africa/Asmara" },
- { "+0230", 0, 9000, "Africa/Asmera" },
- { "+0230", 0, 9000, "Africa/Dar_es_Salaam" },
- { "+0230", 0, 9000, "Africa/Djibouti" },
- { "+0230", 0, 9000, "Africa/Kampala" },
- { "+0230", 0, 9000, "Africa/Mogadishu" },
- { "+0230", 0, 9000, "Africa/Nairobi" },
- { "+0230", 0, 9000, "Indian/Antananarivo" },
- { "+0230", 0, 9000, "Indian/Comoro" },
- { "+0230", 0, 9000, "Indian/Mayotte" },
- { "+0245", 0, 9900, "Africa/Addis_Ababa" },
- { "+0245", 0, 9900, "Africa/Asmara" },
- { "+0245", 0, 9900, "Africa/Asmera" },
- { "+0245", 0, 9900, "Africa/Dar_es_Salaam" },
- { "+0245", 0, 9900, "Africa/Djibouti" },
- { "+0245", 0, 9900, "Africa/Kampala" },
- { "+0245", 0, 9900, "Africa/Mogadishu" },
- { "+0245", 0, 9900, "Africa/Nairobi" },
- { "+0245", 0, 9900, "Indian/Antananarivo" },
- { "+0245", 0, 9900, "Indian/Comoro" },
- { "+0245", 0, 9900, "Indian/Mayotte" },
- { "+0330", 0, 12600, "Asia/Tehran" },
- { "+0430", 0, 16200, "Asia/Kabul" },
- { "+0430", 1, 16200, "Asia/Tehran" },
- { "+0530", 0, 19800, "Asia/Colombo" },
- { "+0530", 0, 19800, "Asia/Dacca" },
- { "+0530", 0, 19800, "Asia/Dhaka" },
- { "+0530", 0, 19800, "Asia/Karachi" },
- { "+0530", 0, 19800, "Asia/Kathmandu" },
- { "+0530", 0, 19800, "Asia/Katmandu" },
- { "+0530", 0, 19800, "Asia/Thimbu" },
- { "+0530", 0, 19800, "Asia/Thimphu" },
- { "+0545", 0, 20700, "Asia/Kathmandu" },
- { "+0545", 0, 20700, "Asia/Katmandu" },
- { "+0630", 0, 23400, "Asia/Calcutta" },
- { "+0630", 0, 23400, "Asia/Colombo" },
- { "+0630", 0, 23400, "Asia/Dacca" },
- { "+0630", 0, 23400, "Asia/Dhaka" },
- { "+0630", 0, 23400, "Asia/Kolkata" },
- { "+0630", 0, 23400, "Asia/Rangoon" },
- { "+0630", 0, 23400, "Asia/Yangon" },
- { "+0630", 0, 23400, "Indian/Cocos" },
- { "+0630", 1, 23400, "Asia/Calcutta" },
- { "+0630", 1, 23400, "Asia/Colombo" },
- { "+0630", 1, 23400, "Asia/Karachi" },
- { "+0630", 1, 23400, "Asia/Kolkata" },
- { "+0720", 0, 26400, "Asia/Jakarta" },
- { "+0720", 0, 26400, "Asia/Kuala_Lumpur" },
- { "+0720", 0, 26400, "Asia/Singapore" },
- { "+0720", 1, 26400, "Asia/Kuala_Lumpur" },
- { "+0720", 1, 26400, "Asia/Singapore" },
- { "+0730", 0, 27000, "Asia/Brunei" },
- { "+0730", 0, 27000, "Asia/Jakarta" },
- { "+0730", 0, 27000, "Asia/Kuala_Lumpur" },
- { "+0730", 0, 27000, "Asia/Kuching" },
- { "+0730", 0, 27000, "Asia/Pontianak" },
- { "+0730", 0, 27000, "Asia/Singapore" },
- { "+0820", 1, 30000, "Asia/Kuching" },
- { "+0845", 0, 31500, "Australia/Eucla" },
- { "+0930", 0, 34200, "Asia/Jayapura" },
- { "+0945", 1, 35100, "Australia/Eucla" },
- { "+1030", 0, 37800, "Australia/LHI" },
- { "+1030", 0, 37800, "Australia/Lord_Howe" },
- { "+1112", 0, 40320, "Pacific/Norfolk" },
- { "+1130", 0, 41400, "Pacific/Nauru" },
- { "+1130", 0, 41400, "Pacific/Norfolk" },
- { "+1130", 1, 41400, "Australia/LHI" },
- { "+1130", 1, 41400, "Australia/Lord_Howe" },
- { "+1215", 0, 44100, "Pacific/Chatham" },
- { "+1220", 0, 44400, "Pacific/Tongatapu" },
- { "+1230", 1, 45000, "Pacific/Norfolk" },
- { "+1245", 0, 45900, "Pacific/Chatham" },
- { "+1345", 1, 49500, "Pacific/Chatham" },
- { "-0230", 1, -9000, "America/Montevideo" },
- { "-0330", 0, -12600, "America/Montevideo" },
- { "-0330", 0, -12600, "America/Paramaribo" },
- { "-0345", 0, -13500, "America/Guyana" },
- { "-0430", 0, -16200, "America/Aruba" },
- { "-0430", 0, -16200, "America/Caracas" },
- { "-0430", 0, -16200, "America/Curacao" },
- { "-0430", 0, -16200, "America/Kralendijk" },
- { "-0430", 0, -16200, "America/Lower_Princes" },
- { "-0430", 1, -16200, "America/Santo_Domingo" },
- { "-0530", 1, -19800, "America/Belize" },
- { "-0830", 0, -30600, "Pacific/Pitcairn" },
- { "-0930", 0, -34200, "Pacific/Marquesas" },
- { "-0930", 1, -34200, "Pacific/Rarotonga" },
- { "-1030", 0, -37800, "Pacific/Rarotonga" },
- { "-1040", 0, -38400, "Pacific/Kiritimati" },
- { "-1120", 0, -40800, "Pacific/Niue" },
- { "-1130", 0, -41400, "Pacific/Apia" },
- { "-1130", 0, -41400, "Pacific/Niue" },
{ "acdt", 1, 37800, "Australia/Adelaide" },
{ "acdt", 1, 37800, "Australia/Broken_Hill" },
{ "acdt", 1, 37800, "Australia/Darwin" },
diff --git a/src/third_party/timelib-2017.05beta5/tm2unixtime.c b/src/third_party/timelib-2017.05beta6/tm2unixtime.c
index c282ba0f6db..42a59cfaa65 100644
--- a/src/third_party/timelib-2017.05beta5/tm2unixtime.c
+++ b/src/third_party/timelib-2017.05beta6/tm2unixtime.c
@@ -433,16 +433,15 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
case TIMELIB_ZONETYPE_OFFSET:
tz->is_localtime = 1;
- return tz->z * 60;
+ return -tz->z;
break;
case TIMELIB_ZONETYPE_ABBR: {
timelib_sll tmp;
tz->is_localtime = 1;
- tmp = tz->z;
- tmp -= tz->dst * 60;
- tmp *= 60;
+ tmp = -tz->z;
+ tmp -= tz->dst * 3600;
return tmp;
}
break;
@@ -456,19 +455,19 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
if (tzi) {
timelib_time_offset *before, *after;
timelib_sll tmp;
- int in_transistion;
+ int in_transition;
tz->is_localtime = 1;
before = timelib_get_time_zone_info(tz->sse, tzi);
after = timelib_get_time_zone_info(tz->sse - before->offset, tzi);
timelib_set_timezone(tz, tzi);
- in_transistion = (
- ((tz->sse - after->offset) >= (after->transistion_time + (before->offset - after->offset))) &&
- ((tz->sse - after->offset) < after->transistion_time)
+ in_transition = (
+ ((tz->sse - after->offset) >= (after->transition_time + (before->offset - after->offset))) &&
+ ((tz->sse - after->offset) < after->transition_time)
);
- if ((before->offset != after->offset) && !in_transistion) {
+ if ((before->offset != after->offset) && !in_transition) {
tmp = -after->offset;
} else {
tmp = -tz->z;
diff --git a/src/third_party/timelib-2017.05beta5/unixtime2tm.c b/src/third_party/timelib-2017.05beta6/unixtime2tm.c
index 3809a350921..803cc46c232 100644
--- a/src/third_party/timelib-2017.05beta5/unixtime2tm.c
+++ b/src/third_party/timelib-2017.05beta6/unixtime2tm.c
@@ -138,7 +138,7 @@ void timelib_update_from_sse(timelib_time *tm)
switch (tm->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_OFFSET: {
- timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));
+ timelib_unixtime2gmt(tm, tm->sse + tm->z + (tm->dst * 3600));
goto cleanup;
}
@@ -176,7 +176,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
int z = tm->z;
signed int dst = tm->dst;
- timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
+ timelib_unixtime2gmt(tm, ts + tm->z + (tm->dst * 3600));
tm->sse = ts;
tm->z = z;
diff --git a/src/third_party/timelib-2017.05beta5/win_dirent.h b/src/third_party/timelib-2017.05beta6/win_dirent.h
index ad9d2b359d0..ad9d2b359d0 100644
--- a/src/third_party/timelib-2017.05beta5/win_dirent.h
+++ b/src/third_party/timelib-2017.05beta6/win_dirent.h
diff --git a/src/third_party/timelib-2017.05beta5/zones/Makefile b/src/third_party/timelib-2017.05beta6/zones/Makefile
index ae1fba4ac80..ae1fba4ac80 100644
--- a/src/third_party/timelib-2017.05beta5/zones/Makefile
+++ b/src/third_party/timelib-2017.05beta6/zones/Makefile
diff --git a/src/third_party/timelib-2017.05beta5/zones/README.rst b/src/third_party/timelib-2017.05beta6/zones/README.rst
index a192b0b2a8e..a192b0b2a8e 100644
--- a/src/third_party/timelib-2017.05beta5/zones/README.rst
+++ b/src/third_party/timelib-2017.05beta6/zones/README.rst
diff --git a/src/third_party/timelib-2017.05beta5/zones/build-idx.php b/src/third_party/timelib-2017.05beta6/zones/build-idx.php
index e5953a1c8cd..e5953a1c8cd 100644
--- a/src/third_party/timelib-2017.05beta5/zones/build-idx.php
+++ b/src/third_party/timelib-2017.05beta6/zones/build-idx.php
diff --git a/src/third_party/timelib-2017.05beta5/zones/create-entry.php b/src/third_party/timelib-2017.05beta6/zones/create-entry.php
index b0e9c478222..b0e9c478222 100644
--- a/src/third_party/timelib-2017.05beta5/zones/create-entry.php
+++ b/src/third_party/timelib-2017.05beta6/zones/create-entry.php
diff --git a/src/third_party/timelib-2017.05beta5/zones/create_dot_h_file.php b/src/third_party/timelib-2017.05beta6/zones/create_dot_h_file.php
index e25cd68f96b..e25cd68f96b 100644
--- a/src/third_party/timelib-2017.05beta5/zones/create_dot_h_file.php
+++ b/src/third_party/timelib-2017.05beta6/zones/create_dot_h_file.php
diff --git a/src/third_party/timelib-2017.05beta5/zones/sort-index.php b/src/third_party/timelib-2017.05beta6/zones/sort-index.php
index d6f9496e2f2..d6f9496e2f2 100644
--- a/src/third_party/timelib-2017.05beta5/zones/sort-index.php
+++ b/src/third_party/timelib-2017.05beta6/zones/sort-index.php
diff --git a/src/third_party/timelib-2017.05beta5/zones/update-package-version.php b/src/third_party/timelib-2017.05beta6/zones/update-package-version.php
index 6fb25521586..6fb25521586 100644
--- a/src/third_party/timelib-2017.05beta5/zones/update-package-version.php
+++ b/src/third_party/timelib-2017.05beta6/zones/update-package-version.php
diff --git a/src/third_party/timelib-2017.05beta5/zones/update-package-xml.php b/src/third_party/timelib-2017.05beta6/zones/update-package-xml.php
index ce5c774a7cc..ce5c774a7cc 100644
--- a/src/third_party/timelib-2017.05beta5/zones/update-package-xml.php
+++ b/src/third_party/timelib-2017.05beta6/zones/update-package-xml.php