Skip to content

Commit 8ea587a

Browse files
committedJul 22, 2022
Import timelib 2022.01
1 parent b1575f9 commit 8ea587a

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed
 

‎ext/date/lib/parse_date.c

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated by re2c 0.15.3 on Sun Jun 26 17:34:01 2022 */
1+
/* Generated by re2c 0.15.3 on Fri Jul 22 15:29:55 2022 */
22
#line 1 "ext/date/lib/parse_date.re"
33
/*
44
* The MIT License (MIT)
@@ -26004,7 +26004,7 @@ timelib_time *timelib_strtotime(const char *s, size_t len, timelib_error_contain
2600426004
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
2600526005
}
2600626006
#define TIMELIB_CHECK_SIGNED_NUMBER \
26007-
if (strchr("-0123456789", *ptr) == NULL) \
26007+
if (strchr("+-0123456789", *ptr) == NULL) \
2600826008
{ \
2600926009
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
2601026010
}
@@ -26079,6 +26079,8 @@ static const timelib_format_specifier default_format_map[] = {
2607926079
{' ', TIMELIB_FORMAT_WHITESPACE},
2608026080
{'y', TIMELIB_FORMAT_YEAR_TWO_DIGIT},
2608126081
{'Y', TIMELIB_FORMAT_YEAR_FOUR_DIGIT},
26082+
{'x', TIMELIB_FORMAT_YEAR_EXPANDED},
26083+
{'X', TIMELIB_FORMAT_YEAR_EXPANDED},
2608226084
{'\0', TIMELIB_FORMAT_END}
2608326085
};
2608426086

@@ -26265,6 +26267,15 @@ timelib_time *timelib_parse_from_format_with_map(const char *format, const char
2626526267
break;
2626626268
}
2626726269

26270+
s->time->have_date = 1;
26271+
break;
26272+
case TIMELIB_FORMAT_YEAR_EXPANDED: /* optional symbol, followed by up to 19 digits */
26273+
TIMELIB_CHECK_SIGNED_NUMBER;
26274+
if ((s->time->y = timelib_get_signed_nr(s, &ptr, 19)) == TIMELIB_UNSET) {
26275+
add_pbf_error(s, TIMELIB_ERR_NO_FOUR_DIGIT_YEAR, "An expanded digit year could not be found", string, begin);
26276+
break;
26277+
}
26278+
2626826279
s->time->have_date = 1;
2626926280
break;
2627026281
case TIMELIB_FORMAT_HOUR_TWO_DIGIT_12_MAX: /* two digit hour, without leading zero */

‎ext/date/lib/parse_date.re

+12-1
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ timelib_time *timelib_strtotime(const char *s, size_t len, timelib_error_contain
20062006
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
20072007
}
20082008
#define TIMELIB_CHECK_SIGNED_NUMBER \
2009-
if (strchr("-0123456789", *ptr) == NULL) \
2009+
if (strchr("+-0123456789", *ptr) == NULL) \
20102010
{ \
20112011
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
20122012
}
@@ -2081,6 +2081,8 @@ static const timelib_format_specifier default_format_map[] = {
20812081
{' ', TIMELIB_FORMAT_WHITESPACE},
20822082
{'y', TIMELIB_FORMAT_YEAR_TWO_DIGIT},
20832083
{'Y', TIMELIB_FORMAT_YEAR_FOUR_DIGIT},
2084+
{'x', TIMELIB_FORMAT_YEAR_EXPANDED},
2085+
{'X', TIMELIB_FORMAT_YEAR_EXPANDED},
20842086
{'\0', TIMELIB_FORMAT_END}
20852087
};
20862088
@@ -2267,6 +2269,15 @@ timelib_time *timelib_parse_from_format_with_map(const char *format, const char
22672269
break;
22682270
}
22692271

2272+
s->time->have_date = 1;
2273+
break;
2274+
case TIMELIB_FORMAT_YEAR_EXPANDED: /* optional symbol, followed by up to 19 digits */
2275+
TIMELIB_CHECK_SIGNED_NUMBER;
2276+
if ((s->time->y = timelib_get_signed_nr(s, &ptr, 19)) == TIMELIB_UNSET) {
2277+
add_pbf_error(s, TIMELIB_ERR_NO_FOUR_DIGIT_YEAR, "An expanded digit year could not be found", string, begin);
2278+
break;
2279+
}
2280+
22702281
s->time->have_date = 1;
22712282
break;
22722283
case TIMELIB_FORMAT_HOUR_TWO_DIGIT_12_MAX: /* two digit hour, without leading zero */

‎ext/date/lib/parse_iso_intervals.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated by re2c 0.15.3 on Sun Jun 26 17:34:21 2022 */
1+
/* Generated by re2c 0.15.3 on Fri Jul 22 15:30:08 2022 */
22
#line 1 "ext/date/lib/parse_iso_intervals.re"
33
/*
44
* The MIT License (MIT)

‎ext/date/lib/timelib.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
# include "timelib_config.h"
3131
#endif
3232

33-
#define TIMELIB_VERSION 202115
34-
#define TIMELIB_EXTENDED_VERSION 20211501
35-
#define TIMELIB_ASCII_VERSION "2021.15"
33+
#define TIMELIB_VERSION 202201
34+
#define TIMELIB_EXTENDED_VERSION 20220101
35+
#define TIMELIB_ASCII_VERSION "2022.01"
3636

3737
#include <stdlib.h>
3838
#include <stdbool.h>
@@ -438,6 +438,7 @@ typedef enum _timelib_format_specifier_code {
438438
TIMELIB_FORMAT_WHITESPACE,
439439
TIMELIB_FORMAT_YEAR_TWO_DIGIT,
440440
TIMELIB_FORMAT_YEAR_FOUR_DIGIT,
441+
TIMELIB_FORMAT_YEAR_EXPANDED,
441442
TIMELIB_FORMAT_YEAR_ISO
442443
} timelib_format_specifier_code;
443444

0 commit comments

Comments
 (0)
Please sign in to comment.