Bumb timelib version to 2015.01

This commit is contained in:
Derick Rethans 2015-09-22 08:41:56 +01:00
parent dcd569aad6
commit fab5cbab1a
18 changed files with 583 additions and 472 deletions

21
ext/date/lib/LICENSE.rst Normal file
View File

@ -0,0 +1,21 @@
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.

View File

@ -1,7 +0,0 @@
Regenerating Parser
===================
Make sure you use re2c 0.9.10 or higher:
re2c -d -b -o ext/date/lib/parse_date.c ext/date/lib/parse_date.re
re2c -d -b -o ext/date/lib/parse_iso_intervals.c ext/date/lib/parse_iso_intervals.re

8
ext/date/lib/README.rst Normal file
View File

@ -0,0 +1,8 @@
timelib
=======
Timelib is a timezone and date/time library that can calculate local time,
convert between timezones and parse textual descriptions of date/time
information.
It is the library supporting PHP's Date/Time extension.

View File

@ -1,26 +1,31 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
* 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.
*/
/*
| Algorithms are taken from a public domain source by Paul |
| Schlyter, who wrote this in December 1992 |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include <stdio.h>
#include <math.h>
#include "timelib.h"

View File

@ -1,3 +1,27 @@
/*
* 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.
*/
/* This macro computes the length of the day, from sunrise to sunset. */
/* Sunrise/set is considered to occur when the Sun's upper limb is */
/* 35 arc minutes below the horizon (this accounts for the refraction */

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#include "timelib.h"
static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#include "timelib.h"
#include <math.h>

View File

@ -1,21 +1,27 @@
/* Generated by re2c 0.13.5 on Tue Mar 31 16:32:03 2015 */
/* Generated by re2c 0.13.5 on Tue Sep 22 08:27:53 2015 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
@ -566,11 +572,11 @@ static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
static timelib_long timelib_lookup_month(char **ptr)
{
char *word;
char *begin = *ptr, *end;
long value = 0;
timelib_long value = 0;
const timelib_lookup_table *tp;
while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
@ -590,7 +596,7 @@ static long timelib_lookup_month(char **ptr)
return value;
}
static long timelib_get_month(char **ptr)
static timelib_long timelib_get_month(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
++*ptr;
@ -670,7 +676,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@ -679,7 +685,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
return timelib_timezone_utc;
}
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
if (!first_found) {
@ -708,11 +714,11 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
long value = 0;
timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
@ -735,10 +741,10 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
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_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;
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@ -766,7 +772,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
long offset = 0;
timelib_long offset = 0;
char *tz_abbr;
t->is_localtime = 1;
@ -810,15 +816,15 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
{
uchar *cursor = s->cur;
char *str, *ptr = NULL;
std:
s->tok = cursor;
s->len = 0;
#line 940 "ext/date/lib/parse_date.re"
#line 946 "ext/date/lib/parse_date.re"
#line 822 "ext/date/lib/parse_date.c"
#line 828 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -958,7 +964,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1620 "ext/date/lib/parse_date.re"
#line 1626 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@ -971,7 +977,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 975 "ext/date/lib/parse_date.c"
#line 981 "ext/date/lib/parse_date.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@ -1282,12 +1288,12 @@ yy11:
if (yych <= '9') goto yy1385;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1715 "ext/date/lib/parse_date.re"
#line 1721 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 1291 "ext/date/lib/parse_date.c"
#line 1297 "ext/date/lib/parse_date.c"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@ -2344,11 +2350,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1704 "ext/date/lib/parse_date.re"
#line 1710 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2352 "ext/date/lib/parse_date.c"
#line 2358 "ext/date/lib/parse_date.c"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@ -2357,12 +2363,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1709 "ext/date/lib/parse_date.re"
#line 1715 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2366 "ext/date/lib/parse_date.c"
#line 2372 "ext/date/lib/parse_date.c"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@ -2749,7 +2755,7 @@ yy71:
if (yych == 's') goto yy73;
yy72:
YYDEBUG(72, *YYCURSOR);
#line 1688 "ext/date/lib/parse_date.re"
#line 1694 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@ -2764,7 +2770,7 @@ yy72:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2768 "ext/date/lib/parse_date.c"
#line 2774 "ext/date/lib/parse_date.c"
yy73:
YYDEBUG(73, *YYCURSOR);
yych = *++YYCURSOR;
@ -3526,7 +3532,7 @@ yy165:
}
yy166:
YYDEBUG(166, *YYCURSOR);
#line 1551 "ext/date/lib/parse_date.re"
#line 1557 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@ -3539,11 +3545,11 @@ yy166:
if (s->time->relative.weekday_behavior != 2) {
s->time->relative.weekday_behavior = 1;
}
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3547 "ext/date/lib/parse_date.c"
#line 3553 "ext/date/lib/parse_date.c"
yy167:
YYDEBUG(167, *YYCURSOR);
yych = *++YYCURSOR;
@ -4063,7 +4069,7 @@ yy192:
}
yy193:
YYDEBUG(193, *YYCURSOR);
#line 1610 "ext/date/lib/parse_date.re"
#line 1616 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@ -4072,7 +4078,7 @@ yy193:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4076 "ext/date/lib/parse_date.c"
#line 4082 "ext/date/lib/parse_date.c"
yy194:
YYDEBUG(194, *YYCURSOR);
++YYCURSOR;
@ -4123,7 +4129,7 @@ yy197:
}
yy198:
YYDEBUG(198, *YYCURSOR);
#line 1356 "ext/date/lib/parse_date.re"
#line 1362 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@ -4136,7 +4142,7 @@ yy198:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4140 "ext/date/lib/parse_date.c"
#line 4146 "ext/date/lib/parse_date.c"
yy199:
YYDEBUG(199, *YYCURSOR);
yyaccept = 6;
@ -4405,7 +4411,7 @@ yy221:
}
yy222:
YYDEBUG(222, *YYCURSOR);
#line 1658 "ext/date/lib/parse_date.re"
#line 1664 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@ -4434,7 +4440,7 @@ yy222:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4438 "ext/date/lib/parse_date.c"
#line 4444 "ext/date/lib/parse_date.c"
yy223:
YYDEBUG(223, *YYCURSOR);
yyaccept = 7;
@ -5132,7 +5138,7 @@ yy277:
YYDEBUG(277, *YYCURSOR);
++YYCURSOR;
YYDEBUG(278, *YYCURSOR);
#line 1634 "ext/date/lib/parse_date.re"
#line 1640 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@ -5155,7 +5161,7 @@ yy277:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5159 "ext/date/lib/parse_date.c"
#line 5165 "ext/date/lib/parse_date.c"
yy279:
YYDEBUG(279, *YYCURSOR);
yych = *++YYCURSOR;
@ -5333,7 +5339,7 @@ yy293:
++YYCURSOR;
yy294:
YYDEBUG(294, *YYCURSOR);
#line 1328 "ext/date/lib/parse_date.re"
#line 1334 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@ -5346,7 +5352,7 @@ yy294:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5350 "ext/date/lib/parse_date.c"
#line 5356 "ext/date/lib/parse_date.c"
yy295:
YYDEBUG(295, *YYCURSOR);
yych = *++YYCURSOR;
@ -6566,7 +6572,7 @@ yy361:
if (yych <= '9') goto yy364;
yy363:
YYDEBUG(363, *YYCURSOR);
#line 1472 "ext/date/lib/parse_date.re"
#line 1478 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@ -6579,7 +6585,7 @@ yy363:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6583 "ext/date/lib/parse_date.c"
#line 6589 "ext/date/lib/parse_date.c"
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
@ -7217,7 +7223,7 @@ yy391:
}
yy392:
YYDEBUG(392, *YYCURSOR);
#line 1530 "ext/date/lib/parse_date.re"
#line 1536 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@ -7237,7 +7243,7 @@ yy392:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7241 "ext/date/lib/parse_date.c"
#line 7247 "ext/date/lib/parse_date.c"
yy393:
YYDEBUG(393, *YYCURSOR);
yyaccept = 5;
@ -8987,7 +8993,7 @@ yy453:
++YYCURSOR;
yy454:
YYDEBUG(454, *YYCURSOR);
#line 1233 "ext/date/lib/parse_date.re"
#line 1239 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@ -8998,7 +9004,7 @@ yy454:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 9002 "ext/date/lib/parse_date.c"
#line 9008 "ext/date/lib/parse_date.c"
yy455:
YYDEBUG(455, *YYCURSOR);
yyaccept = 0;
@ -9558,7 +9564,7 @@ yy474:
}
yy475:
YYDEBUG(475, *YYCURSOR);
#line 1370 "ext/date/lib/parse_date.re"
#line 1376 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@ -9569,7 +9575,7 @@ yy475:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9573 "ext/date/lib/parse_date.c"
#line 9579 "ext/date/lib/parse_date.c"
yy476:
YYDEBUG(476, *YYCURSOR);
yyaccept = 10;
@ -9710,7 +9716,7 @@ yy487:
YYDEBUG(487, *YYCURSOR);
++YYCURSOR;
YYDEBUG(488, *YYCURSOR);
#line 1088 "ext/date/lib/parse_date.re"
#line 1094 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@ -9726,7 +9732,7 @@ yy487:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9730 "ext/date/lib/parse_date.c"
#line 9736 "ext/date/lib/parse_date.c"
yy489:
YYDEBUG(489, *YYCURSOR);
yyaccept = 11;
@ -9739,7 +9745,7 @@ yy489:
}
yy490:
YYDEBUG(490, *YYCURSOR);
#line 1125 "ext/date/lib/parse_date.re"
#line 1131 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@ -9764,7 +9770,7 @@ yy490:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9768 "ext/date/lib/parse_date.c"
#line 9774 "ext/date/lib/parse_date.c"
yy491:
YYDEBUG(491, *YYCURSOR);
yyaccept = 11;
@ -10074,7 +10080,7 @@ yy522:
YYDEBUG(522, *YYCURSOR);
++YYCURSOR;
YYDEBUG(523, *YYCURSOR);
#line 1105 "ext/date/lib/parse_date.re"
#line 1111 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@ -10093,7 +10099,7 @@ yy522:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10097 "ext/date/lib/parse_date.c"
#line 10103 "ext/date/lib/parse_date.c"
yy524:
YYDEBUG(524, *YYCURSOR);
yyaccept = 11;
@ -10199,7 +10205,7 @@ yy533:
if (yych <= '9') goto yy540;
yy534:
YYDEBUG(534, *YYCURSOR);
#line 1287 "ext/date/lib/parse_date.re"
#line 1293 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@ -10213,7 +10219,7 @@ yy534:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10217 "ext/date/lib/parse_date.c"
#line 10223 "ext/date/lib/parse_date.c"
yy535:
YYDEBUG(535, *YYCURSOR);
yych = *++YYCURSOR;
@ -10950,7 +10956,7 @@ yy604:
YYDEBUG(605, *YYCURSOR);
++YYCURSOR;
YYDEBUG(606, *YYCURSOR);
#line 1302 "ext/date/lib/parse_date.re"
#line 1308 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@ -10961,7 +10967,7 @@ yy604:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10965 "ext/date/lib/parse_date.c"
#line 10971 "ext/date/lib/parse_date.c"
yy607:
YYDEBUG(607, *YYCURSOR);
yyaccept = 11;
@ -10997,7 +11003,7 @@ yy610:
if (yych <= '9') goto yy604;
yy611:
YYDEBUG(611, *YYCURSOR);
#line 1314 "ext/date/lib/parse_date.re"
#line 1320 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@ -11010,7 +11016,7 @@ yy611:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11014 "ext/date/lib/parse_date.c"
#line 11020 "ext/date/lib/parse_date.c"
yy612:
YYDEBUG(612, *YYCURSOR);
yyaccept = 11;
@ -11651,7 +11657,7 @@ yy655:
}
yy656:
YYDEBUG(656, *YYCURSOR);
#line 1273 "ext/date/lib/parse_date.re"
#line 1279 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@ -11664,7 +11670,7 @@ yy656:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11668 "ext/date/lib/parse_date.c"
#line 11674 "ext/date/lib/parse_date.c"
yy657:
YYDEBUG(657, *YYCURSOR);
yyaccept = 13;
@ -11770,7 +11776,7 @@ yy665:
}
yy666:
YYDEBUG(666, *YYCURSOR);
#line 1217 "ext/date/lib/parse_date.re"
#line 1223 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@ -11785,7 +11791,7 @@ yy666:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11789 "ext/date/lib/parse_date.c"
#line 11795 "ext/date/lib/parse_date.c"
yy667:
YYDEBUG(667, *YYCURSOR);
yyaccept = 14;
@ -12018,7 +12024,7 @@ yy699:
if (yych <= ':') goto yy703;
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1500 "ext/date/lib/parse_date.re"
#line 1506 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@ -12038,7 +12044,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12042 "ext/date/lib/parse_date.c"
#line 12048 "ext/date/lib/parse_date.c"
yy701:
YYDEBUG(701, *YYCURSOR);
yych = *++YYCURSOR;
@ -12590,7 +12596,7 @@ yy762:
}
yy763:
YYDEBUG(763, *YYCURSOR);
#line 1245 "ext/date/lib/parse_date.re"
#line 1251 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@ -12603,7 +12609,7 @@ yy763:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12607 "ext/date/lib/parse_date.c"
#line 12613 "ext/date/lib/parse_date.c"
yy764:
YYDEBUG(764, *YYCURSOR);
yych = *++YYCURSOR;
@ -12642,7 +12648,7 @@ yy770:
YYDEBUG(770, *YYCURSOR);
++YYCURSOR;
YYDEBUG(771, *YYCURSOR);
#line 1486 "ext/date/lib/parse_date.re"
#line 1492 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@ -12655,7 +12661,7 @@ yy770:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12659 "ext/date/lib/parse_date.c"
#line 12665 "ext/date/lib/parse_date.c"
yy772:
YYDEBUG(772, *YYCURSOR);
yych = *++YYCURSOR;
@ -12793,7 +12799,7 @@ yy782:
}
yy783:
YYDEBUG(783, *YYCURSOR);
#line 1521 "ext/date/lib/parse_date.re"
#line 1527 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@ -12801,7 +12807,7 @@ yy783:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12805 "ext/date/lib/parse_date.c"
#line 12811 "ext/date/lib/parse_date.c"
yy784:
YYDEBUG(784, *YYCURSOR);
yych = *++YYCURSOR;
@ -12952,7 +12958,7 @@ yy792:
}
yy793:
YYDEBUG(793, *YYCURSOR);
#line 1342 "ext/date/lib/parse_date.re"
#line 1348 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@ -12965,7 +12971,7 @@ yy793:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 12969 "ext/date/lib/parse_date.c"
#line 12975 "ext/date/lib/parse_date.c"
yy794:
YYDEBUG(794, *YYCURSOR);
yych = *++YYCURSOR;
@ -13180,14 +13186,14 @@ yy813:
if (yych <= '7') goto yy816;
yy814:
YYDEBUG(814, *YYCURSOR);
#line 1453 "ext/date/lib/parse_date.re"
#line 1459 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
w = timelib_get_nr((char **) &ptr, 2);
d = 1;
@ -13198,7 +13204,7 @@ yy814:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13202 "ext/date/lib/parse_date.c"
#line 13208 "ext/date/lib/parse_date.c"
yy815:
YYDEBUG(815, *YYCURSOR);
yych = *++YYCURSOR;
@ -13208,14 +13214,14 @@ yy816:
YYDEBUG(816, *YYCURSOR);
++YYCURSOR;
YYDEBUG(817, *YYCURSOR);
#line 1434 "ext/date/lib/parse_date.re"
#line 1440 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
TIMELIB_HAVE_RELATIVE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
w = timelib_get_nr((char **) &ptr, 2);
d = timelib_get_nr((char **) &ptr, 1);
@ -13226,7 +13232,7 @@ yy816:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13230 "ext/date/lib/parse_date.c"
#line 13236 "ext/date/lib/parse_date.c"
yy818:
YYDEBUG(818, *YYCURSOR);
yych = *++YYCURSOR;
@ -13290,7 +13296,7 @@ yy820:
}
yy821:
YYDEBUG(821, *YYCURSOR);
#line 1420 "ext/date/lib/parse_date.re"
#line 1426 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@ -13303,7 +13309,7 @@ yy821:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13307 "ext/date/lib/parse_date.c"
#line 13313 "ext/date/lib/parse_date.c"
yy822:
YYDEBUG(822, *YYCURSOR);
yych = *++YYCURSOR;
@ -13406,7 +13412,7 @@ yy841:
++YYCURSOR;
yy842:
YYDEBUG(842, *YYCURSOR);
#line 1394 "ext/date/lib/parse_date.re"
#line 1400 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@ -13431,7 +13437,7 @@ yy842:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13435 "ext/date/lib/parse_date.c"
#line 13441 "ext/date/lib/parse_date.c"
yy843:
YYDEBUG(843, *YYCURSOR);
yych = *++YYCURSOR;
@ -13693,7 +13699,7 @@ yy847:
}
yy848:
YYDEBUG(848, *YYCURSOR);
#line 1382 "ext/date/lib/parse_date.re"
#line 1388 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@ -13704,7 +13710,7 @@ yy848:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 13708 "ext/date/lib/parse_date.c"
#line 13714 "ext/date/lib/parse_date.c"
yy849:
YYDEBUG(849, *YYCURSOR);
yych = *++YYCURSOR;
@ -14624,7 +14630,7 @@ yy972:
if (yych <= '9') goto yy995;
yy973:
YYDEBUG(973, *YYCURSOR);
#line 1259 "ext/date/lib/parse_date.re"
#line 1265 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@ -14637,7 +14643,7 @@ yy973:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14641 "ext/date/lib/parse_date.c"
#line 14647 "ext/date/lib/parse_date.c"
yy974:
YYDEBUG(974, *YYCURSOR);
yyaccept = 22;
@ -15646,7 +15652,7 @@ yy1065:
}
yy1067:
YYDEBUG(1067, *YYCURSOR);
#line 1151 "ext/date/lib/parse_date.re"
#line 1157 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@ -15668,7 +15674,7 @@ yy1067:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 15672 "ext/date/lib/parse_date.c"
#line 15678 "ext/date/lib/parse_date.c"
yy1068:
YYDEBUG(1068, *YYCURSOR);
yych = *++YYCURSOR;
@ -15760,7 +15766,7 @@ yy1074:
}
yy1075:
YYDEBUG(1075, *YYCURSOR);
#line 1197 "ext/date/lib/parse_date.re"
#line 1203 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@ -15779,7 +15785,7 @@ yy1075:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 15783 "ext/date/lib/parse_date.c"
#line 15789 "ext/date/lib/parse_date.c"
yy1076:
YYDEBUG(1076, *YYCURSOR);
yyaccept = 25;
@ -16677,7 +16683,7 @@ yy1116:
}
yy1117:
YYDEBUG(1117, *YYCURSOR);
#line 1593 "ext/date/lib/parse_date.re"
#line 1599 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -16693,7 +16699,7 @@ yy1117:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16697 "ext/date/lib/parse_date.c"
#line 16703 "ext/date/lib/parse_date.c"
yy1118:
YYDEBUG(1118, *YYCURSOR);
++YYCURSOR;
@ -16744,7 +16750,7 @@ yy1125:
YYDEBUG(1125, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1126, *YYCURSOR);
#line 1066 "ext/date/lib/parse_date.re"
#line 1072 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -16765,7 +16771,7 @@ yy1125:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 16769 "ext/date/lib/parse_date.c"
#line 16775 "ext/date/lib/parse_date.c"
yy1127:
YYDEBUG(1127, *YYCURSOR);
yyaccept = 26;
@ -16873,7 +16879,7 @@ yy1140:
}
yy1141:
YYDEBUG(1141, *YYCURSOR);
#line 1569 "ext/date/lib/parse_date.re"
#line 1575 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@ -16896,7 +16902,7 @@ yy1141:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16900 "ext/date/lib/parse_date.c"
#line 16906 "ext/date/lib/parse_date.c"
yy1142:
YYDEBUG(1142, *YYCURSOR);
yych = *++YYCURSOR;
@ -19573,7 +19579,7 @@ yy1293:
goto yy1297;
yy1294:
YYDEBUG(1294, *YYCURSOR);
#line 1043 "ext/date/lib/parse_date.re"
#line 1049 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@ -19595,7 +19601,7 @@ yy1294:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19599 "ext/date/lib/parse_date.c"
#line 19605 "ext/date/lib/parse_date.c"
yy1295:
YYDEBUG(1295, *YYCURSOR);
yyaccept = 28;
@ -19856,7 +19862,7 @@ yy1315:
YYDEBUG(1315, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1316, *YYCURSOR);
#line 1026 "ext/date/lib/parse_date.re"
#line 1032 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@ -19872,7 +19878,7 @@ yy1315:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19876 "ext/date/lib/parse_date.c"
#line 19882 "ext/date/lib/parse_date.c"
yy1317:
YYDEBUG(1317, *YYCURSOR);
yyaccept = 0;
@ -21303,7 +21309,7 @@ yy1385:
if (yych <= '9') goto yy1385;
yy1387:
YYDEBUG(1387, *YYCURSOR);
#line 1000 "ext/date/lib/parse_date.re"
#line 1006 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@ -21328,7 +21334,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21332 "ext/date/lib/parse_date.c"
#line 21338 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@ -21764,7 +21770,7 @@ yy1416:
++YYCURSOR;
yy1417:
YYDEBUG(1417, *YYCURSOR);
#line 988 "ext/date/lib/parse_date.re"
#line 994 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@ -21775,7 +21781,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21779 "ext/date/lib/parse_date.c"
#line 21785 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@ -21810,7 +21816,7 @@ yy1419:
}
yy1420:
YYDEBUG(1420, *YYCURSOR);
#line 978 "ext/date/lib/parse_date.re"
#line 984 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@ -21819,7 +21825,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21823 "ext/date/lib/parse_date.c"
#line 21829 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@ -23831,7 +23837,7 @@ yy1499:
}
yy1500:
YYDEBUG(1500, *YYCURSOR);
#line 957 "ext/date/lib/parse_date.re"
#line 963 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@ -23839,7 +23845,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23843 "ext/date/lib/parse_date.c"
#line 23849 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@ -23978,7 +23984,7 @@ yy1507:
}
yy1508:
YYDEBUG(1508, *YYCURSOR);
#line 966 "ext/date/lib/parse_date.re"
#line 972 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@ -23989,7 +23995,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23993 "ext/date/lib/parse_date.c"
#line 23999 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@ -24522,7 +24528,7 @@ yy1530:
++YYCURSOR;
yy1531:
YYDEBUG(1531, *YYCURSOR);
#line 945 "ext/date/lib/parse_date.re"
#line 951 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@ -24533,7 +24539,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 24537 "ext/date/lib/parse_date.c"
#line 24543 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@ -24706,13 +24712,13 @@ yy1537:
goto yy1531;
}
}
#line 1719 "ext/date/lib/parse_date.re"
#line 1725 "ext/date/lib/parse_date.re"
}
#define YYMAXFILL 31
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
{
Scanner in;
int t;
@ -24823,7 +24829,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
}
timelib_time *timelib_parse_from_format(char *format, char *string, int 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 *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
{
char *fptr = format;
char *ptr = string;
@ -24868,7 +24874,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
add_pbf_error(s, "A textual day could not be found", string, begin);
break;
} else {
in.time->have_relative = 1;
in.time->have_relative = 1;
in.time->relative.have_weekday_relative = 1;
in.time->relative.weekday = tmprel->multiplier;
in.time->relative.weekday_behavior = 1;
@ -25139,13 +25145,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
/* do funky checking whether the parsed time was valid time */
if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
s->time->s != TIMELIB_UNSET &&
s->time->s != TIMELIB_UNSET &&
!timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
add_pbf_warning(s, "The parsed time was invalid", string, ptr);
}
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
!timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
add_pbf_warning(s, "The parsed date was invalid", string, ptr);
}
@ -25193,7 +25199,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;
@ -25218,7 +25224,7 @@ int main(void)
printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d",
time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
if (time.have_relative) {
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
printf ("%3dY %3dM %3dD / %3dH %3dM %3dS",
time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);
}
if (time.have_weekday_relative) {
@ -25227,7 +25233,7 @@ int main(void)
if (time.have_weeknr_day) {
printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);
}
return 0;
return 0;
}
#endif

View File

@ -1,19 +1,25 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
@ -564,11 +570,11 @@ static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
static timelib_long timelib_lookup_month(char **ptr)
{
char *word;
char *begin = *ptr, *end;
long value = 0;
timelib_long value = 0;
const timelib_lookup_table *tp;
while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
@ -588,7 +594,7 @@ static long timelib_lookup_month(char **ptr)
return value;
}
static long timelib_get_month(char **ptr)
static timelib_long timelib_get_month(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
++*ptr;
@ -668,7 +674,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@ -706,11 +712,11 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
long value = 0;
timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
@ -733,10 +739,10 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
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_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;
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@ -764,7 +770,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
long offset = 0;
timelib_long offset = 0;
char *tz_abbr;
t->is_localtime = 1;
@ -871,7 +877,7 @@ iso8601normtz = 't'? hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz
gnunocolon = 't'? hour24lz minutelz;
/* gnunocolontz = hour24lz minutelz space? (tzcorrection | tz); */
iso8601nocolon = 't'? hour24lz minutelz secondlz;
iso8601nocolon = 't'? hour24lz minutelz secondlz;
/* iso8601nocolontz = hour24lz minutelz secondlz space? (tzcorrection | tz); */
/* Date formats */
@ -1721,7 +1727,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
/*!max:re2c */
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
{
Scanner in;
int t;
@ -1832,7 +1838,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
}
timelib_time *timelib_parse_from_format(char *format, char *string, int 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 *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
{
char *fptr = format;
char *ptr = string;
@ -2202,7 +2208,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;

View File

@ -1,21 +1,27 @@
/* Generated by re2c 0.13.5 on Wed Nov 27 11:14:23 2013 */
/* Generated by re2c 0.13.5 on Tue Sep 22 08:27:59 2015 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
@ -190,9 +196,9 @@ static void timelib_eat_until_separator(char **ptr)
}
}
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@ -244,15 +250,15 @@ static int scan(Scanner *s)
{
uchar *cursor = s->cur;
char *str, *ptr = NULL;
std:
s->tok = cursor;
s->len = 0;
#line 276 "ext/date/lib/parse_iso_intervals.re"
#line 282 "ext/date/lib/parse_iso_intervals.re"
#line 256 "ext/date/lib/parse_iso_intervals.c"
#line 262 "ext/date/lib/parse_iso_intervals.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@ -322,12 +328,12 @@ std:
if (yych <= '9') goto yy98;
yy3:
YYDEBUG(3, *YYCURSOR);
#line 389 "ext/date/lib/parse_iso_intervals.re"
#line 395 "ext/date/lib/parse_iso_intervals.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 331 "ext/date/lib/parse_iso_intervals.c"
#line 337 "ext/date/lib/parse_iso_intervals.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yyaccept = 0;
@ -344,7 +350,7 @@ yy5:
if (yych == 'T') goto yy14;
yy6:
YYDEBUG(6, *YYCURSOR);
#line 316 "ext/date/lib/parse_iso_intervals.re"
#line 322 "ext/date/lib/parse_iso_intervals.re"
{
timelib_sll nr;
int in_time = 0;
@ -368,11 +374,11 @@ yy6:
case 'D': s->period->d = nr; break;
case 'H': s->period->h = nr; break;
case 'S': s->period->s = nr; break;
case 'M':
case 'M':
if (in_time) {
s->period->i = nr;
} else {
s->period->m = nr;
s->period->m = nr;
}
break;
default:
@ -385,26 +391,26 @@ yy6:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 389 "ext/date/lib/parse_iso_intervals.c"
#line 395 "ext/date/lib/parse_iso_intervals.c"
yy7:
YYDEBUG(7, *YYCURSOR);
++YYCURSOR;
YYDEBUG(8, *YYCURSOR);
#line 378 "ext/date/lib/parse_iso_intervals.re"
#line 384 "ext/date/lib/parse_iso_intervals.re"
{
goto std;
}
#line 398 "ext/date/lib/parse_iso_intervals.c"
#line 404 "ext/date/lib/parse_iso_intervals.c"
yy9:
YYDEBUG(9, *YYCURSOR);
++YYCURSOR;
YYDEBUG(10, *YYCURSOR);
#line 383 "ext/date/lib/parse_iso_intervals.re"
#line 389 "ext/date/lib/parse_iso_intervals.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 408 "ext/date/lib/parse_iso_intervals.c"
#line 414 "ext/date/lib/parse_iso_intervals.c"
yy11:
YYDEBUG(11, *YYCURSOR);
yych = *++YYCURSOR;
@ -734,7 +740,7 @@ yy51:
YYDEBUG(57, *YYCURSOR);
++YYCURSOR;
YYDEBUG(58, *YYCURSOR);
#line 358 "ext/date/lib/parse_iso_intervals.re"
#line 364 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("combinedrep");
TIMELIB_INIT;
@ -753,7 +759,7 @@ yy51:
TIMELIB_DEINIT;
return TIMELIB_PERIOD;
}
#line 757 "ext/date/lib/parse_iso_intervals.c"
#line 763 "ext/date/lib/parse_iso_intervals.c"
yy59:
YYDEBUG(59, *YYCURSOR);
yych = *++YYCURSOR;
@ -882,7 +888,7 @@ yy83:
YYDEBUG(83, *YYCURSOR);
++YYCURSOR;
YYDEBUG(84, *YYCURSOR);
#line 292 "ext/date/lib/parse_iso_intervals.re"
#line 298 "ext/date/lib/parse_iso_intervals.re"
{
timelib_time *current;
@ -905,7 +911,7 @@ yy83:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 909 "ext/date/lib/parse_iso_intervals.c"
#line 915 "ext/date/lib/parse_iso_intervals.c"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
@ -983,7 +989,7 @@ yy98:
if (yych <= '9') goto yy98;
yy100:
YYDEBUG(100, *YYCURSOR);
#line 281 "ext/date/lib/parse_iso_intervals.re"
#line 287 "ext/date/lib/parse_iso_intervals.re"
{
DEBUG_OUTPUT("recurrences");
TIMELIB_INIT;
@ -993,9 +999,9 @@ yy100:
s->have_recurrences = 1;
return TIMELIB_PERIOD;
}
#line 997 "ext/date/lib/parse_iso_intervals.c"
#line 1003 "ext/date/lib/parse_iso_intervals.c"
}
#line 393 "ext/date/lib/parse_iso_intervals.re"
#line 399 "ext/date/lib/parse_iso_intervals.re"
}
#ifdef PHP_WIN32
@ -1004,9 +1010,9 @@ yy100:
#define YYMAXFILL 20
void timelib_strtointerval(char *s, int len,
timelib_time **begin, timelib_time **end,
timelib_rel_time **period, int *recurrences,
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)
{
Scanner in;

View File

@ -1,19 +1,25 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
@ -188,9 +194,9 @@ static void timelib_eat_until_separator(char **ptr)
}
}
static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
long retval = 0;
timelib_long retval = 0;
*tz_not_found = 0;
@ -398,7 +404,7 @@ isoweek = year4 "-"? "W" weekofyear;
/*!max:re2c */
void timelib_strtointerval(char *s, int len,
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)

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#include "timelib.h"
#include <stdio.h>
@ -263,12 +267,12 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
printf("Geo Location: %f,%f\n", tz->location.latitude, tz->location.longitude);
printf("Comments:\n%s\n", tz->location.comments);
printf("BC: %s\n", tz->bc ? "" : "yes");
printf("UTC/Local count: %lu\n", (unsigned long) tz->bit32.ttisgmtcnt);
printf("Std/Wall count: %lu\n", (unsigned long) tz->bit32.ttisstdcnt);
printf("Leap.sec. count: %lu\n", (unsigned long) tz->bit32.leapcnt);
printf("Trans. count: %lu\n", (unsigned long) tz->bit32.timecnt);
printf("Local types count: %lu\n", (unsigned long) tz->bit32.typecnt);
printf("Zone Abbr. count: %lu\n", (unsigned long) tz->bit32.charcnt);
printf("UTC/Local count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.ttisgmtcnt);
printf("Std/Wall count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.ttisstdcnt);
printf("Leap.sec. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.leapcnt);
printf("Trans. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.timecnt);
printf("Local types count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.typecnt);
printf("Zone Abbr. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->bit32.charcnt);
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
"", "", 0,
@ -424,13 +428,13 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
*transition_time = 0;
j = 0;
while (j < tz->bit32.timecnt && tz->type[j].isdst) {
while (j < tz->bit32.timecnt && tz->type[tz->trans_idx[j]].isdst) {
++j;
}
if (j == tz->bit32.timecnt) {
j = 0;
}
return &(tz->type[j]);
return &(tz->type[tz->trans_idx[j]]);
}
/* In all other cases we loop through the available transtion times to find

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#include "timelib.h"
#include <ctype.h>
#include <math.h>
@ -71,10 +75,11 @@ timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
{
unsigned int i;
size_t tz_abbr_len = strlen(tz_abbr);
TIMELIB_TIME_FREE(tm->tz_abbr);
tm->tz_abbr = strdup(tz_abbr);
for (i = 0; i < strlen(tz_abbr); i++) {
for (i = 0; i < tz_abbr_len; i++) {
tm->tz_abbr[i] = toupper(tz_abbr[i]);
}
}
@ -176,13 +181,13 @@ void timelib_error_container_dtor(timelib_error_container *errors)
free(errors);
}
signed long timelib_date_to_int(timelib_time *d, int *error)
timelib_long timelib_date_to_int(timelib_time *d, int *error)
{
timelib_sll ts;
ts = d->sse;
if (ts < LONG_MIN || ts > LONG_MAX) {
if (ts < TIMELIB_LONG_MIN || ts > TIMELIB_LONG_MAX) {
if (error) {
*error = 1;
}
@ -191,7 +196,7 @@ signed long timelib_date_to_int(timelib_time *d, int *error)
if (error) {
*error = 0;
}
return (signed long) d->sse;
return (timelib_long) d->sse;
}
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
@ -286,10 +291,10 @@ void timelib_dump_rel_time(timelib_rel_time *d)
printf("\n");
}
long timelib_parse_tz_cor(char **ptr)
timelib_long timelib_parse_tz_cor(char **ptr)
{
char *begin = *ptr, *end;
long tmp;
timelib_long tmp;
while (isdigit(**ptr) || **ptr == ':') {
++*ptr;

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#ifndef __TIMELIB_H__
#define __TIMELIB_H__
@ -26,7 +30,8 @@
#include <limits.h>
#endif
#define TIMELIB_VERSION 201102
#define TIMELIB_VERSION 201501
#define TIMELIB_ASCII_VERSION "2015.01"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
@ -71,15 +76,15 @@ 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, int 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, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
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, long gmtoffset, int isdst);
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
long timelib_parse_tz_cor(char**);
timelib_long timelib_parse_tz_cor(char**);
/* From parse_iso_intervals.re */
void timelib_strtointerval(char *s, int len,
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);
@ -108,7 +113,7 @@ 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_builtin_identifiers_list(int *count);
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_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 timelib.c */
timelib_tzinfo* timelib_tzinfo_ctor(char *name);
@ -131,12 +136,12 @@ void timelib_time_offset_dtor(timelib_time_offset* t);
void timelib_error_container_dtor(timelib_error_container *errors);
signed long timelib_date_to_int(timelib_time *d, int *error);
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);
long timelib_parse_tz_cor(char **ptr);
timelib_long timelib_parse_tz_cor(char **ptr);
/* from astro.c */
double timelib_ts_to_juliandate(timelib_sll ts);

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#ifndef __TIMELIB_STRUCTS_H__
#define __TIMELIB_STRUCTS_H__
@ -121,6 +125,24 @@ typedef unsigned __int64 uint64_t;
#include <strings.h>
#endif
#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
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;
@ -249,10 +271,10 @@ typedef struct timelib_error_message {
} timelib_error_message;
typedef struct timelib_error_container {
int warning_count;
struct timelib_error_message *error_messages;
struct timelib_error_message *warning_messages;
int error_count;
struct timelib_error_message *error_messages;
int warning_count;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {

View File

@ -23,9 +23,6 @@
{ "acwst", 0, 31500, "Australia/Eucla" },
{ "addt", 1, -7200, "America/Goose_Bay" },
{ "addt", 1, -7200, "America/Pangnirtung" },
{ "admt", 0, 9320, "Africa/Addis_Ababa" },
{ "admt", 0, 9320, "Africa/Asmara" },
{ "admt", 0, 9320, "Africa/Asmera" },
{ "adt", 1, -10800, "America/Halifax" },
{ "adt", 1, -10800, "America/Barbados" },
{ "adt", 1, -10800, "America/Blanc-Sablon" },
@ -124,7 +121,6 @@
{ "ant", 0, -16200, "America/Aruba" },
{ "ant", 0, -16200, "America/Kralendijk" },
{ "ant", 0, -16200, "America/Lower_Princes" },
{ "aot", 0, 3124, "Africa/Luanda" },
{ "apt", 1, -10800, "America/Halifax" },
{ "apt", 1, -10800, "America/Blanc-Sablon" },
{ "apt", 1, -10800, "America/Glace_Bay" },
@ -236,6 +232,7 @@
{ "ast", 0, -14400, "America/Dominica" },
{ "ast", 0, -14400, "America/Glace_Bay" },
{ "ast", 0, -14400, "America/Goose_Bay" },
{ "ast", 0, -14400, "America/Grand_Turk" },
{ "ast", 0, -14400, "America/Grenada" },
{ "ast", 0, -14400, "America/Guadeloupe" },
{ "ast", 0, -14400, "America/Halifax" },
@ -305,16 +302,34 @@
{ "bdt", 1, -36000, "America/Nome" },
{ "bdt", 0, 21600, "Asia/Dhaka" },
{ "beat", 0, 9000, "Africa/Mogadishu" },
{ "beat", 0, 9000, "Africa/Addis_Ababa" },
{ "beat", 0, 9000, "Africa/Asmara" },
{ "beat", 0, 9000, "Africa/Asmera" },
{ "beat", 0, 9000, "Africa/Dar_es_Salaam" },
{ "beat", 0, 9000, "Africa/Djibouti" },
{ "beat", 0, 9000, "Africa/Kampala" },
{ "beat", 0, 9000, "Africa/Nairobi" },
{ "beat", 0, 9000, "Indian/Antananarivo" },
{ "beat", 0, 9000, "Indian/Comoro" },
{ "beat", 0, 9000, "Indian/Mayotte" },
{ "beaut", 0, 9900, "Africa/Nairobi" },
{ "beaut", 0, 9900, "Africa/Addis_Ababa" },
{ "beaut", 0, 9900, "Africa/Asmara" },
{ "beaut", 0, 9900, "Africa/Asmera" },
{ "beaut", 0, 9900, "Africa/Dar_es_Salaam" },
{ "beaut", 0, 9900, "Africa/Djibouti" },
{ "beaut", 0, 9900, "Africa/Kampala" },
{ "beaut", 0, 9900, "Africa/Mogadishu" },
{ "beaut", 0, 9900, "Indian/Antananarivo" },
{ "beaut", 0, 9900, "Indian/Comoro" },
{ "beaut", 0, 9900, "Indian/Mayotte" },
{ "bmt", 0, -14309, "America/Barbados" },
{ "bmt", 0, 6264, "Europe/Tiraspol" },
{ "bmt", 0, -17776, "America/Bogota" },
{ "bmt", 0, 10656, "Asia/Baghdad" },
{ "bmt", 0, 24124, "Asia/Bangkok" },
{ "bmt", 0, 24124, "Asia/Phnom_Penh" },
{ "bmt", 0, 24124, "Asia/Vientiane" },
{ "bmt", 0, 25632, "Asia/Jakarta" },
{ "bmt", 0, 6264, "Europe/Bucharest" },
{ "bmt", 0, 6264, "Europe/Chisinau" },
@ -362,6 +377,7 @@
{ "bst", 1, 3600, "Europe/Isle_of_Man" },
{ "bst", 1, 3600, "Europe/Jersey" },
{ "bst", 1, 3600, "GB" },
{ "bst", 0, 39600, "Pacific/Bougainville" },
{ "btt", 0, 21600, "Asia/Thimbu" },
{ "btt", 0, 21600, "Asia/Thimphu" },
{ "burt", 0, 23400, "Asia/Kolkata" },
@ -372,7 +388,6 @@
{ "cant", 0, -3600, "Atlantic/Canary" },
{ "capt", 1, -32400, "America/Anchorage" },
{ "cast", 0, 34200, "Australia/Adelaide" },
{ "cast", 1, 10800, "Africa/Gaborone" },
{ "cast", 1, 10800, "Africa/Juba" },
{ "cast", 1, 10800, "Africa/Khartoum" },
{ "cast", 0, 39600, "Antarctica/Casey" },
@ -445,7 +460,6 @@
{ "cdt", 1, 32400, "PRC" },
{ "cdt", 1, 32400, "ROC" },
{ "cemt", 1, 10800, "Europe/Berlin" },
{ "cemt", 1, 10800, "CET" },
{ "cest", 1, 7200, "Europe/Berlin" },
{ "cest", 1, 10800, "Europe/Kaliningrad" },
{ "cest", 1, 7200, "Africa/Algiers" },
@ -455,7 +469,6 @@
{ "cest", 1, 7200, "Antarctica/Troll" },
{ "cest", 1, 7200, "Arctic/Longyearbyen" },
{ "cest", 1, 7200, "Atlantic/Jan_Mayen" },
{ "cest", 1, 7200, "CET" },
{ "cest", 1, 7200, "Europe/Amsterdam" },
{ "cest", 1, 7200, "Europe/Andorra" },
{ "cest", 1, 7200, "Europe/Athens" },
@ -500,7 +513,6 @@
{ "cest", 1, 7200, "Europe/Zagreb" },
{ "cest", 1, 7200, "Europe/Zaporozhye" },
{ "cest", 1, 7200, "Europe/Zurich" },
{ "cest", 1, 7200, "WET" },
{ "cet", 0, 3600, "Europe/Berlin" },
{ "cet", 0, 7200, "Europe/Kaliningrad" },
{ "cet", 0, 3600, "Africa/Algiers" },
@ -510,7 +522,6 @@
{ "cet", 0, 3600, "Africa/Tunis" },
{ "cet", 0, 3600, "Arctic/Longyearbyen" },
{ "cet", 0, 3600, "Atlantic/Jan_Mayen" },
{ "cet", 0, 3600, "CET" },
{ "cet", 0, 3600, "Europe/Amsterdam" },
{ "cet", 0, 3600, "Europe/Andorra" },
{ "cet", 0, 3600, "Europe/Athens" },
@ -555,7 +566,6 @@
{ "cet", 0, 3600, "Europe/Zagreb" },
{ "cet", 0, 3600, "Europe/Zaporozhye" },
{ "cet", 0, 3600, "Europe/Zurich" },
{ "cet", 0, 3600, "WET" },
{ "cgst", 1, -3600, "America/Scoresbysund" },
{ "cgt", 0, -7200, "America/Scoresbysund" },
{ "chadt", 1, 49500, "Pacific/Chatham" },
@ -563,6 +573,7 @@
{ "chast", 0, 44100, "Pacific/Chatham" },
{ "chdt", 1, -19800, "America/Belize" },
{ "chost", 1, 36000, "Asia/Choibalsan" },
{ "chost", 1, 32400, "Asia/Choibalsan" },
{ "chot", 0, 32400, "Asia/Choibalsan" },
{ "chot", 0, 28800, "Asia/Choibalsan" },
{ "chut", 0, 36000, "Pacific/Chuuk" },
@ -577,7 +588,10 @@
{ "clst", 1, -10800, "Chile/Continental" },
{ "clst", 1, -14400, "Chile/Continental" },
{ "clt", 0, -14400, "America/Santiago" },
{ "clt", 0, -10800, "America/Santiago" },
{ "clt", 0, -18000, "America/Santiago" },
{ "clt", 0, -10800, "Antarctica/Palmer" },
{ "clt", 0, -10800, "Chile/Continental" },
{ "clt", 0, -14400, "Antarctica/Palmer" },
{ "clt", 0, -14400, "Chile/Continental" },
{ "clt", 0, -18000, "Chile/Continental" },
@ -602,6 +616,7 @@
{ "cmt", 0, -15408, "America/Rosario" },
{ "cmt", 0, -16060, "America/Caracas" },
{ "cmt", 0, -16356, "America/La_Paz" },
{ "cmt", 0, -19176, "America/Cayman" },
{ "cmt", 0, -19176, "America/Panama" },
{ "cmt", 0, 6900, "Europe/Chisinau" },
{ "cmt", 0, 6900, "Europe/Tiraspol" },
@ -735,9 +750,10 @@
{ "easst", 1, -18000, "Chile/EasterIsland" },
{ "easst", 1, -18000, "Pacific/Easter" },
{ "easst", 1, -21600, "Pacific/Easter" },
{ "east", 0, -18000, "Chile/EasterIsland" },
{ "east", 0, -21600, "Chile/EasterIsland" },
{ "east", 0, -25200, "Chile/EasterIsland" },
{ "east", 1, 14400, "Indian/Antananarivo" },
{ "east", 0, -18000, "Pacific/Easter" },
{ "east", 0, -21600, "Pacific/Easter" },
{ "east", 0, -25200, "Pacific/Easter" },
{ "eat", 0, 10800, "Africa/Khartoum" },
@ -783,7 +799,6 @@
{ "edt", 1, -14400, "America/Thunder_Bay" },
{ "edt", 1, -14400, "America/Toronto" },
{ "edt", 1, -14400, "Canada/Eastern" },
{ "edt", 1, -14400, "EST" },
{ "eest", 1, 10800, "Europe/Helsinki" },
{ "eest", 1, 10800, "Africa/Cairo" },
{ "eest", 1, 10800, "Asia/Amman" },
@ -793,7 +808,6 @@
{ "eest", 1, 10800, "Asia/Hebron" },
{ "eest", 1, 10800, "Asia/Istanbul" },
{ "eest", 1, 10800, "Asia/Nicosia" },
{ "eest", 1, 10800, "EET" },
{ "eest", 1, 10800, "Europe/Athens" },
{ "eest", 1, 10800, "Europe/Bucharest" },
{ "eest", 1, 10800, "Europe/Chisinau" },
@ -826,7 +840,6 @@
{ "eet", 0, 7200, "Asia/Hebron" },
{ "eet", 0, 7200, "Asia/Istanbul" },
{ "eet", 0, 7200, "Asia/Nicosia" },
{ "eet", 0, 7200, "EET" },
{ "eet", 0, 7200, "Europe/Athens" },
{ "eet", 0, 7200, "Europe/Bucharest" },
{ "eet", 0, 7200, "Europe/Chisinau" },
@ -859,9 +872,7 @@
{ "ept", 1, -14400, "America/Thunder_Bay" },
{ "ept", 1, -14400, "America/Toronto" },
{ "ept", 1, -14400, "Canada/Eastern" },
{ "ept", 1, -14400, "EST" },
{ "est", 0, -18000, "America/New_York" },
{ "est", 0, -18000, "America/Antigua" },
{ "est", 0, -18000, "America/Atikokan" },
{ "est", 0, -18000, "America/Cambridge_Bay" },
{ "est", 0, -18000, "America/Cancun" },
@ -902,7 +913,6 @@
{ "est", 0, -18000, "America/Thunder_Bay" },
{ "est", 0, -18000, "America/Toronto" },
{ "est", 0, -18000, "Canada/Eastern" },
{ "est", 0, -18000, "EST" },
{ "ewt", 1, -14400, "America/New_York" },
{ "ewt", 1, -14400, "America/Detroit" },
{ "ewt", 1, -14400, "America/Iqaluit" },
@ -911,7 +921,6 @@
{ "ewt", 1, -14400, "America/Thunder_Bay" },
{ "ewt", 1, -14400, "America/Toronto" },
{ "ewt", 1, -14400, "Canada/Eastern" },
{ "ewt", 1, -14400, "EST" },
{ "fet", 0, 10800, "Europe/Kaliningrad" },
{ "fet", 0, 10800, "Europe/Minsk" },
{ "ffmt", 0, -14660, "America/Martinique" },
@ -953,12 +962,9 @@
{ "gmt", 0, 0, "Africa/Dakar" },
{ "gmt", 0, 0, "Africa/Freetown" },
{ "gmt", 0, 0, "Africa/Lome" },
{ "gmt", 0, 0, "Africa/Malabo" },
{ "gmt", 0, 0, "Africa/Monrovia" },
{ "gmt", 0, 0, "Africa/Niamey" },
{ "gmt", 0, 0, "Africa/Nouakchott" },
{ "gmt", 0, 0, "Africa/Ouagadougou" },
{ "gmt", 0, 0, "Africa/Porto-Novo" },
{ "gmt", 0, 0, "Africa/Sao_Tome" },
{ "gmt", 0, 0, "Africa/Timbuktu" },
{ "gmt", 0, 0, "America/Danmarkshavn" },
@ -980,6 +986,7 @@
{ "gst", 0, 14400, "Asia/Muscat" },
{ "gst", 0, 14400, "Asia/Qatar" },
{ "gst", 0, 36000, "Pacific/Guam" },
{ "gst", 0, 36000, "Pacific/Saipan" },
{ "gyt", 0, -14400, "America/Guyana" },
{ "gyt", 0, -10800, "America/Guyana" },
{ "gyt", 0, -13500, "America/Guyana" },
@ -988,7 +995,6 @@
{ "hast", 0, -36000, "America/Adak" },
{ "hast", 0, -36000, "America/Atka" },
{ "hdt", 1, -34200, "Pacific/Honolulu" },
{ "hdt", 1, -34200, "HST" },
{ "hdt", 1, -34200, "Pacific/Johnston" },
{ "hkst", 1, 32400, "Asia/Hong_Kong" },
{ "hkt", 0, 28800, "Asia/Hong_Kong" },
@ -998,7 +1004,6 @@
{ "hmt", 0, 21200, "Asia/Dacca" },
{ "hmt", 0, 21200, "Asia/Dhaka" },
{ "hmt", 0, 21200, "Asia/Kolkata" },
{ "hmt", 0, 5989, "EET" },
{ "hmt", 0, 5989, "Europe/Helsinki" },
{ "hmt", 0, 5989, "Europe/Mariehamn" },
{ "hovst", 1, 28800, "Asia/Hovd" },
@ -1006,27 +1011,23 @@
{ "hovt", 0, 21600, "Asia/Hovd" },
{ "hst", 0, -36000, "Pacific/Honolulu" },
{ "hst", 0, -37800, "Pacific/Honolulu" },
{ "hst", 0, -36000, "HST" },
{ "hst", 0, -36000, "Pacific/Johnston" },
{ "hst", 0, -37800, "HST" },
{ "hst", 0, -37800, "Pacific/Johnston" },
{ "ict", 0, 25200, "Asia/Bangkok" },
{ "ict", 0, 25200, "Asia/Ho_Chi_Minh" },
{ "ict", 0, 25200, "Asia/Phnom_Penh" },
{ "ict", 0, 25200, "Asia/Saigon" },
{ "ict", 0, 25200, "Asia/Vientiane" },
{ "ict", 0, 28800, "Asia/Ho_Chi_Minh" },
{ "ict", 0, 28800, "Asia/Phnom_Penh" },
{ "ict", 0, 28800, "Asia/Saigon" },
{ "ict", 0, 28800, "Asia/Vientiane" },
{ "iddt", 1, 14400, "Asia/Jerusalem" },
{ "iddt", 1, 14400, "Asia/Tel_Aviv" },
{ "idt", 1, 10800, "Asia/Jerusalem" },
{ "idt", 1, 10800, "Asia/Gaza" },
{ "idt", 1, 10800, "Asia/Hebron" },
{ "idt", 1, 10800, "Asia/Tel_Aviv" },
{ "idt", 0, 28800, "Asia/Ho_Chi_Minh" },
{ "idt", 0, 28800, "Asia/Saigon" },
{ "ihst", 1, 21600, "Asia/Colombo" },
{ "imt", 0, 25035, "Asia/Irkutsk" },
{ "imt", 0, 25025, "Asia/Irkutsk" },
{ "imt", 0, 7016, "Asia/Istanbul" },
{ "imt", 0, 7016, "Europe/Istanbul" },
{ "iot", 0, 21600, "Indian/Chagos" },
@ -1075,6 +1076,7 @@
{ "jmt", 0, 8440, "Asia/Tel_Aviv" },
{ "jst", 0, 32400, "Asia/Tokyo" },
{ "jst", 0, 32400, "Asia/Dili" },
{ "jst", 0, 32400, "Asia/Ho_Chi_Minh" },
{ "jst", 0, 32400, "Asia/Hong_Kong" },
{ "jst", 0, 32400, "Asia/Jakarta" },
{ "jst", 0, 32400, "Asia/Kuala_Lumpur" },
@ -1084,11 +1086,13 @@
{ "jst", 0, 32400, "Asia/Pontianak" },
{ "jst", 0, 32400, "Asia/Pyongyang" },
{ "jst", 0, 32400, "Asia/Rangoon" },
{ "jst", 0, 32400, "Asia/Saigon" },
{ "jst", 0, 32400, "Asia/Sakhalin" },
{ "jst", 0, 32400, "Asia/Seoul" },
{ "jst", 0, 32400, "Asia/Singapore" },
{ "jst", 0, 32400, "Asia/Taipei" },
{ "jst", 0, 32400, "Asia/Ujung_Pandang" },
{ "jst", 0, 32400, "Pacific/Bougainville" },
{ "jst", 0, 32400, "Pacific/Nauru" },
{ "jst", 0, 32400, "ROC" },
{ "jst", 0, 32400, "ROK" },
@ -1096,8 +1100,8 @@
{ "jwst", 0, 28800, "ROC" },
{ "kart", 0, 18000, "Asia/Karachi" },
{ "kdt", 1, 36000, "Asia/Seoul" },
{ "kdt", 1, 32400, "Asia/Seoul" },
{ "kdt", 1, 32400, "ROK" },
{ "kdt", 1, 34200, "Asia/Seoul" },
{ "kdt", 1, 34200, "ROK" },
{ "kdt", 1, 36000, "ROK" },
{ "kgst", 1, 21600, "Asia/Bishkek" },
{ "kgt", 0, 18000, "Asia/Bishkek" },
@ -1107,7 +1111,6 @@
{ "kizt", 0, 14400, "Asia/Qyzylorda" },
{ "kizt", 0, 18000, "Asia/Qyzylorda" },
{ "kmt", 0, 5736, "Europe/Vilnius" },
{ "kmt", 0, -18431, "America/Cayman" },
{ "kmt", 0, -18431, "America/Grand_Turk" },
{ "kmt", 0, -18431, "America/Jamaica" },
{ "kmt", 0, 7324, "Europe/Kiev" },
@ -1122,12 +1125,9 @@
{ "krat", 0, 28800, "Asia/Krasnoyarsk" },
{ "krat", 0, 21600, "Asia/Novokuznetsk" },
{ "krat", 0, 25200, "Asia/Novokuznetsk" },
{ "kst", 0, 28800, "Asia/Seoul" },
{ "kst", 0, 30600, "Asia/Seoul" },
{ "kst", 0, 32400, "Asia/Pyongyang" },
{ "kst", 0, 32400, "Asia/Seoul" },
{ "kst", 0, 28800, "Asia/Pyongyang" },
{ "kst", 0, 28800, "ROK" },
{ "kst", 0, 30600, "Asia/Pyongyang" },
{ "kst", 0, 30600, "ROK" },
{ "kst", 0, 32400, "ROK" },
@ -1147,7 +1147,7 @@
{ "lkt", 0, 23400, "Asia/Colombo" },
{ "lkt", 0, 21600, "Asia/Colombo" },
{ "lrt", 0, -2670, "Africa/Monrovia" },
{ "lst", 1, 9388, "Europe/Riga" },
{ "lst", 1, 9394, "Europe/Riga" },
{ "madmt", 1, 3600, "Atlantic/Madeira" },
{ "madst", 1, 0, "Atlantic/Madeira" },
{ "madt", 0, -3600, "Atlantic/Madeira" },
@ -1202,9 +1202,6 @@
{ "mdt", 1, -21600, "Canada/Mountain" },
{ "mdt", 1, -21600, "Canada/Saskatchewan" },
{ "mdt", 1, -21600, "Mexico/BajaSur" },
{ "mdt", 1, -21600, "MST" },
{ "mest", 1, 7200, "MET" },
{ "met", 0, 3600, "MET" },
{ "mht", 0, 43200, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Kwajalein" },
{ "mht", 0, 39600, "Pacific/Majuro" },
@ -1226,7 +1223,6 @@
{ "mot", 0, 28800, "Asia/Macao" },
{ "mot", 0, 28800, "Asia/Macau" },
{ "mpt", 1, -21600, "America/Denver" },
{ "mpt", 0, 36000, "Pacific/Saipan" },
{ "mpt", 1, -21600, "America/Boise" },
{ "mpt", 1, -21600, "America/Cambridge_Bay" },
{ "mpt", 1, -21600, "America/Edmonton" },
@ -1240,8 +1236,6 @@
{ "mpt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mpt", 1, -21600, "Canada/Mountain" },
{ "mpt", 1, -21600, "Canada/Saskatchewan" },
{ "mpt", 1, -21600, "MST" },
{ "mpt", 0, 32400, "Pacific/Saipan" },
{ "msd", 1, 14400, "Europe/Moscow" },
{ "msd", 1, 14400, "Europe/Chisinau" },
{ "msd", 1, 14400, "Europe/Kaliningrad" },
@ -1254,6 +1248,7 @@
{ "msd", 1, 14400, "Europe/Tiraspol" },
{ "msd", 1, 14400, "Europe/Uzhgorod" },
{ "msd", 1, 14400, "Europe/Vilnius" },
{ "msd", 1, 14400, "Europe/Volgograd" },
{ "msd", 1, 14400, "Europe/Zaporozhye" },
{ "msk", 0, 10800, "Europe/Moscow" },
{ "msk", 0, 14400, "Europe/Moscow" },
@ -1272,7 +1267,6 @@
{ "msk", 0, 10800, "Europe/Zaporozhye" },
{ "msk", 0, 14400, "Europe/Simferopol" },
{ "msk", 0, 14400, "Europe/Volgograd" },
{ "msk", 1, 14400, "Europe/Volgograd" },
{ "msm", 1, 18000, "Europe/Moscow" },
{ "mst", 0, -25200, "America/Denver" },
{ "mst", 0, -25200, "America/Bahia_Banderas" },
@ -1304,7 +1298,6 @@
{ "mst", 0, -25200, "Mexico/BajaNorte" },
{ "mst", 0, -25200, "Mexico/BajaSur" },
{ "mst", 0, -25200, "Mexico/General" },
{ "mst", 0, -25200, "MST" },
{ "mst", 1, 12679, "Europe/Moscow" },
{ "must", 1, 18000, "Indian/Mauritius" },
{ "mut", 0, 14400, "Indian/Mauritius" },
@ -1324,7 +1317,6 @@
{ "mwt", 1, -21600, "Canada/East-Saskatchewan" },
{ "mwt", 1, -21600, "Canada/Mountain" },
{ "mwt", 1, -21600, "Canada/Saskatchewan" },
{ "mwt", 1, -21600, "MST" },
{ "myt", 0, 28800, "Asia/Kuala_Lumpur" },
{ "myt", 0, 28800, "Asia/Kuching" },
{ "ncst", 1, 43200, "Pacific/Noumea" },
@ -1333,7 +1325,6 @@
{ "nddt", 1, -5400, "Canada/Newfoundland" },
{ "ndt", 1, -9052, "America/St_Johns" },
{ "ndt", 1, -9000, "America/St_Johns" },
{ "ndt", 1, -36000, "Pacific/Midway" },
{ "ndt", 1, -9000, "America/Goose_Bay" },
{ "ndt", 1, -9000, "Canada/Newfoundland" },
{ "ndt", 1, -9052, "America/Goose_Bay" },
@ -1342,7 +1333,6 @@
{ "nest", 1, 4800, "Europe/Amsterdam" },
{ "net", 0, 1200, "Europe/Amsterdam" },
{ "nft", 0, 41400, "Pacific/Norfolk" },
{ "nmt", 0, 20928, "Asia/Novokuznetsk" },
{ "nmt", 0, 40320, "Pacific/Norfolk" },
{ "novst", 1, 25200, "Asia/Novosibirsk" },
{ "novst", 1, 28800, "Asia/Novosibirsk" },
@ -1433,6 +1423,7 @@
{ "pett", 0, 43200, "Asia/Kamchatka" },
{ "pett", 0, 39600, "Asia/Kamchatka" },
{ "pet", 0, -18000, "America/Lima" },
{ "pgt", 0, 36000, "Pacific/Bougainville" },
{ "pgt", 0, 36000, "Pacific/Port_Moresby" },
{ "phot", 0, 46800, "Pacific/Enderbury" },
{ "phot", 0, -39600, "Pacific/Enderbury" },
@ -1441,17 +1432,19 @@
{ "pht", 0, 28800, "Asia/Manila" },
{ "pkst", 1, 21600, "Asia/Karachi" },
{ "pkt", 0, 18000, "Asia/Karachi" },
{ "plmt", 0, 25590, "Asia/Ho_Chi_Minh" },
{ "plmt", 0, 25590, "Asia/Saigon" },
{ "pmdt", 1, -7200, "America/Miquelon" },
{ "pmst", 0, -10800, "America/Miquelon" },
{ "pmt", 0, -13236, "America/Paramaribo" },
{ "pmt", 0, -13252, "America/Paramaribo" },
{ "pmt", 0, 36000, "Antarctica/DumontDUrville" },
{ "pmt", 0, 13505, "Asia/Yekaterinburg" },
{ "pmt", 0, 26240, "Asia/Pontianak" },
{ "pmt", 0, 561, "Africa/Algiers" },
{ "pmt", 0, 561, "Africa/Tunis" },
{ "pmt", 0, 561, "Europe/Monaco" },
{ "pmt", 0, 561, "Europe/Paris" },
{ "pmt", 0, 561, "WET" },
{ "pnt", 0, -30600, "Pacific/Pitcairn" },
{ "pont", 0, 39600, "Pacific/Pohnpei" },
{ "pont", 0, 39600, "Pacific/Ponape" },
@ -1509,8 +1502,7 @@
{ "qyzt", 0, 21600, "Asia/Qyzylorda" },
{ "qyzt", 0, 18000, "Asia/Qyzylorda" },
{ "ret", 0, 14400, "Indian/Reunion" },
{ "rmt", 0, 5788, "Europe/Riga" },
{ "rmt", 0, -5268, "Atlantic/Reykjavik" },
{ "rmt", 0, 5794, "Europe/Riga" },
{ "rmt", 0, 23080, "Asia/Rangoon" },
{ "rott", 0, -10800, "Antarctica/Rothera" },
{ "sakst", 1, 39600, "Asia/Sakhalin" },
@ -1528,8 +1520,10 @@
{ "sast", 1, 10800, "Africa/Johannesburg" },
{ "sast", 0, 5400, "Africa/Johannesburg" },
{ "sast", 1, 10800, "Africa/Maseru" },
{ "sast", 1, 10800, "Africa/Mbabane" },
{ "sast", 1, 10800, "Africa/Windhoek" },
{ "sast", 0, 5400, "Africa/Gaborone" },
{ "sast", 0, 5400, "Africa/Maseru" },
{ "sast", 0, 5400, "Africa/Mbabane" },
{ "sast", 0, 7200, "Africa/Maseru" },
{ "sast", 0, 7200, "Africa/Mbabane" },
{ "sast", 0, 7200, "Africa/Windhoek" },
@ -1543,15 +1537,11 @@
{ "shet", 0, 21600, "Asia/Aqtau" },
{ "shet", 0, 18000, "Asia/Aqtau" },
{ "sjmt", 0, -20173, "America/Costa_Rica" },
{ "smt", 0, 25580, "Asia/Saigon" },
{ "smt", 0, -13884, "Atlantic/Stanley" },
{ "smt", 0, -16966, "America/Santiago" },
{ "smt", 0, -16966, "Chile/Continental" },
{ "smt", 0, 24925, "Asia/Kuala_Lumpur" },
{ "smt", 0, 24925, "Asia/Singapore" },
{ "smt", 0, 25580, "Asia/Ho_Chi_Minh" },
{ "smt", 0, 25580, "Asia/Phnom_Penh" },
{ "smt", 0, 25580, "Asia/Vientiane" },
{ "smt", 0, 8160, "Europe/Simferopol" },
{ "sret", 0, 39600, "Asia/Srednekolymsk" },
{ "srt", 0, -10800, "America/Paramaribo" },
@ -1579,7 +1569,7 @@
{ "tbist", 1, 14400, "Asia/Tbilisi" },
{ "tbit", 0, 14400, "Asia/Tbilisi" },
{ "tbit", 0, 10800, "Asia/Tbilisi" },
{ "tbmt", 0, 10746, "Asia/Tbilisi" },
{ "tbmt", 0, 10751, "Asia/Tbilisi" },
{ "tft", 0, 18000, "Indian/Kerguelen" },
{ "tjt", 0, 18000, "Asia/Dushanbe" },
{ "tkt", 0, -39600, "Pacific/Fakaofo" },
@ -1602,7 +1592,6 @@
{ "tsat", 0, 10800, "Europe/Volgograd" },
{ "tvt", 0, 43200, "Pacific/Funafuti" },
{ "uct", 0, 0, "Etc/UCT" },
{ "uct", 0, 0, "UCT" },
{ "ulast", 1, 32400, "Asia/Ulaanbaatar" },
{ "ulast", 1, 32400, "Asia/Ulan_Bator" },
{ "ulat", 0, 28800, "Asia/Ulaanbaatar" },
@ -1620,7 +1609,6 @@
{ "utc", 0, 0, "Etc/Universal" },
{ "utc", 0, 0, "Etc/UTC" },
{ "utc", 0, 0, "Etc/Zulu" },
{ "utc", 0, 0, "GMT" },
{ "utc", 0, 0, "UTC" },
{ "utc", 0, 0, "UTC" },
{ "uyhst", 1, -9000, "America/Montevideo" },
@ -1679,7 +1667,6 @@
{ "wat", 0, 3600, "Africa/Brazzaville" },
{ "wat", 0, -3600, "Africa/Bissau" },
{ "wat", 0, -3600, "Africa/El_Aaiun" },
{ "wat", 0, -3600, "Africa/Niamey" },
{ "wat", 0, 3600, "Africa/Bangui" },
{ "wat", 0, 3600, "Africa/Douala" },
{ "wat", 0, 3600, "Africa/Kinshasa" },
@ -1695,7 +1682,6 @@
{ "wemt", 1, 7200, "Europe/Madrid" },
{ "wemt", 1, 7200, "Europe/Monaco" },
{ "wemt", 1, 7200, "Europe/Paris" },
{ "wemt", 1, 7200, "WET" },
{ "west", 1, 3600, "Europe/Paris" },
{ "west", 1, 7200, "Europe/Luxembourg" },
{ "west", 1, 3600, "Africa/Algiers" },
@ -1711,7 +1697,6 @@
{ "west", 1, 3600, "Europe/Luxembourg" },
{ "west", 1, 3600, "Europe/Madrid" },
{ "west", 1, 3600, "Europe/Monaco" },
{ "west", 1, 3600, "WET" },
{ "wet", 0, 0, "Europe/Paris" },
{ "wet", 0, 3600, "Europe/Luxembourg" },
{ "wet", 0, 0, "Africa/Algiers" },
@ -1729,7 +1714,6 @@
{ "wet", 0, 0, "Europe/Luxembourg" },
{ "wet", 0, 0, "Europe/Madrid" },
{ "wet", 0, 0, "Europe/Monaco" },
{ "wet", 0, 0, "WET" },
{ "wft", 0, 43200, "Pacific/Wallis" },
{ "wgst", 1, -7200, "America/Godthab" },
{ "wgst", 1, -7200, "America/Danmarkshavn" },

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#include "timelib.h"
/* jan feb mrt apr may jun jul aug sep oct nov dec */

View File

@ -1,23 +1,27 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
* 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.
*/
/* $Id$ */
#include "timelib.h"
#include <stdio.h>