Lines Matching refs:s

34 # define strtoll(s, f, b) _atoi64(s)
37 # define strtoll(s, f, b) atoll(s)
39 # define strtoll(s, f, b) strtol(s, f, b)
86 #define YYLIMIT s->lim
87 #define YYMARKER s->ptr
90 #define RET(i) {s->cur = cursor; return i;}
94s->time->have_time) { add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification"); timelib_…
95 #define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s
96 … (s->time->have_date) { add_error(s, TIMELIB_ERR_DOUBLE_DATE, "Double date specification"); timeli…
97 #define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y …
98 #define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
99 #define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_weekda…
100 #define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_specia…
101s->cur = cursor; if (s->time->have_zone) { s->time->have_zone > 1 ? add_error(s, TIMELIB_ERR_DOUBL…
103 #define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
120 #define DEBUG_OUTPUT(s) printf("%s\n", s);
121 #define YYDEBUG(s,c) { if (s != -1) { printf("state: %d ", s); printf("[%c]\n", c); } }
123 #define DEBUG_OUTPUT(s)
124 #define YYDEBUG(s,c)
175 { "µs", TIMELIB_MICROSEC, 1 },
291 static char* timelib_ltrim(char *s)
293 char *ptr = s;
302 uchar *fill(Scanner *s, uchar *cursor){
303 if(!s->eof){
304 unsigned int cnt = s->tok - s->bot;
306 memcpy(s->bot, s->tok, s->lim - s->tok);
307 s->tok = s->bot;
308 s->ptr -= cnt;
310 s->pos -= cnt;
311 s->lim -= cnt;
313 if((s->top - s->lim) < BSIZE){
314 uchar *buf = (uchar*) timelib_malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
315 memcpy(buf, s->tok, s->lim - s->tok);
316 s->tok = buf;
317 s->ptr = &buf[s->ptr - s->bot];
318 cursor = &buf[cursor - s->bot];
319 s->pos = &buf[s->pos - s->bot];
320 s->lim = &buf[s->lim - s->bot];
321 s->top = &s->lim[BSIZE];
322 timelib_free(s->bot);
323 s->bot = buf;
325 if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){
326 s->eof = &s->lim[cnt]; *(s->eof)++ = '\n';
328 s->lim += cnt;
334 static void add_warning(Scanner *s, int error_code, char *error)
336 s->errors->warning_count++;
337s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_coun…
338 s->errors->warning_messages[s->errors->warning_count - 1].error_code = error_code;
339 s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
340 s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
341 s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
344 static void add_error(Scanner *s, int error_code, char *error)
346 s->errors->error_count++;
347s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * si…
348 s->errors->error_messages[s->errors->error_count - 1].error_code = error_code;
349 s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
350 s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
351 s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
354 static void add_pbf_warning(Scanner *s, int error_code, char *error, char *sptr, char *cptr)
356 s->errors->warning_count++;
357s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_coun…
358 s->errors->warning_messages[s->errors->warning_count - 1].error_code = error_code;
359 s->errors->warning_messages[s->errors->warning_count - 1].position = cptr - sptr;
360 s->errors->warning_messages[s->errors->warning_count - 1].character = *cptr;
361 s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
364 static void add_pbf_error(Scanner *s, int error_code, char *error, char *sptr, char *cptr)
366 s->errors->error_count++;
367s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * si…
368 s->errors->error_messages[s->errors->error_count - 1].error_code = error_code;
369 s->errors->error_messages[s->errors->error_count - 1].position = cptr - sptr;
370 s->errors->error_messages[s->errors->error_count - 1].character = *cptr;
371 s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
437 static char *timelib_string(Scanner *s)
439 char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
440 memcpy(tmp, s->tok, s->cur - s->tok);
639 static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
648 case TIMELIB_MICROSEC: s->time->relative.us += amount * relunit->multiplier; break;
649 case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
650 case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
651 case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
652 case TIMELIB_DAY: s->time->relative.d += amount * relunit->multiplier; break;
653 case TIMELIB_MONTH: s->time->relative.m += amount * relunit->multiplier; break;
654 case TIMELIB_YEAR: s->time->relative.y += amount * relunit->multiplier; break;
659 s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
660 s->time->relative.weekday = relunit->multiplier;
661 s->time->relative.weekday_behavior = behavior;
667 s->time->relative.special.type = relunit->multiplier;
668 s->time->relative.special.amount = amount;
700 /* Still didn't find anything, let's find the zone solely based on
880 static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
882 uchar *cursor = s->cur;
886 s->tok = cursor;
887 s->len = 0;
1005 … | 'µs' | (('msec'|'millisecond'|'µsec'|'microsecond'|'usec'|'sec'|'second'|'min'|'minute'|'hour'|…
1025 s->time->relative.d = -1;
1045 s->time->h = 12;
1068 s->time->relative.d = 1;
1084 s->time->y = 1970;
1085 s->time->m = 1;
1086 s->time->d = 1;
1087 s->time->h = s->time->i = s->time->s = 0;
1088 s->time->us = 0;
1089 s->time->relative.s += i;
1090 s->time->is_localtime = 1;
1091 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1092 s->time->z = 0;
1093 s->time->dst = 0;
1111 s->time->y = 1970;
1112 s->time->m = 1;
1113 s->time->d = 1;
1114 s->time->h = s->time->i = s->time->s = 0;
1115 s->time->us = 0;
1116 s->time->relative.s += i;
1117 s->time->relative.us = us;
1118 s->time->is_localtime = 1;
1119 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1120 s->time->z = 0;
1121 s->time->dst = 0;
1135 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_LAST_DAY_OF_MONTH;
1137 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH;
1152 s->time->h = timelib_get_nr((char **) &ptr, 2);
1153 s->time->i = 15;
1155 s->time->h = timelib_get_nr((char **) &ptr, 2) - 1;
1156 s->time->i = 45;
1160 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1179 s->time->relative.special.type = TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH;
1180 timelib_set_relative((char **) &ptr, i, 1, s);
1182 s->time->relative.special.type = TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH;
1183 timelib_set_relative((char **) &ptr, i, behavior, s);
1194 s->time->h = timelib_get_nr((char **) &ptr, 2);
1196 s->time->i = timelib_get_nr((char **) &ptr, 2);
1198 s->time->s = timelib_get_nr((char **) &ptr, 2);
1201 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1211 s->time->h = timelib_get_nr((char **) &ptr, 2);
1212 s->time->i = timelib_get_nr((char **) &ptr, 2);
1214 s->time->s = timelib_get_nr((char **) &ptr, 2);
1217 s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
1221 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1232 s->time->h = timelib_get_nr((char **) &ptr, 2);
1233 s->time->i = timelib_get_nr((char **) &ptr, 2);
1235 s->time->s = timelib_get_nr((char **) &ptr, 2);
1238 s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
1243s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1245 add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
1256 switch (s->time->have_time) {
1258 s->time->h = timelib_get_nr((char **) &ptr, 2);
1259 s->time->i = timelib_get_nr((char **) &ptr, 2);
1260 s->time->s = 0;
1263 s->time->y = timelib_get_nr((char **) &ptr, 4);
1267 add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification");
1270 s->time->have_time++;
1279 switch (s->time->have_time) {
1281 s->time->h = timelib_get_nr((char **) &ptr, 2);
1282 s->time->i = timelib_get_nr((char **) &ptr, 2);
1283 s->time->s = 0;
1284s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1287 s->time->y = timelib_get_nr((char **) &ptr, 4);
1293 s->time->have_time++;
1304 s->time->h = timelib_get_nr((char **) &ptr, 2);
1305 s->time->i = timelib_get_nr((char **) &ptr, 2);
1306 s->time->s = timelib_get_nr((char **) &ptr, 2);
1309s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1311 add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
1324 s->time->m = timelib_get_nr((char **) &ptr, 2);
1325 s->time->d = timelib_get_nr((char **) &ptr, 2);
1327 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1328 TIMELIB_PROCESS_YEAR(s->time->y, length);
1339 s->time->y = timelib_get_unsigned_nr((char **) &ptr, 4);
1340 s->time->m = timelib_get_nr((char **) &ptr, 2);
1341 s->time->d = timelib_get_nr((char **) &ptr, 2);
1352 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1353 s->time->m = timelib_get_nr((char **) &ptr, 2);
1354 s->time->d = timelib_get_nr((char **) &ptr, 2);
1355 TIMELIB_PROCESS_YEAR(s->time->y, length);
1366 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1367 s->time->m = timelib_get_nr((char **) &ptr, 2);
1368 s->time->d = 1;
1369 TIMELIB_PROCESS_YEAR(s->time->y, length);
1380 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1381 s->time->m = timelib_get_nr((char **) &ptr, 2);
1382 s->time->d = timelib_get_nr((char **) &ptr, 2);
1383 TIMELIB_PROCESS_YEAR(s->time->y, length);
1394 s->time->d = timelib_get_nr((char **) &ptr, 2);
1396 s->time->m = timelib_get_month((char **) &ptr);
1397 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1398 TIMELIB_PROCESS_YEAR(s->time->y, length);
1408 s->time->d = timelib_get_nr((char **) &ptr, 2);
1409 s->time->m = timelib_get_nr((char **) &ptr, 2);
1410 s->time->y = timelib_get_nr((char **) &ptr, 4);
1421 s->time->d = timelib_get_nr((char **) &ptr, 2);
1422 s->time->m = timelib_get_nr((char **) &ptr, 2);
1423 s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length);
1424 TIMELIB_PROCESS_YEAR(s->time->y, length);
1435 s->time->m = timelib_get_month((char **) &ptr);
1436 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1437 s->time->d = 1;
1438 TIMELIB_PROCESS_YEAR(s->time->y, length);
1449 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1450 s->time->m = timelib_get_month((char **) &ptr);
1451 s->time->d = 1;
1452 TIMELIB_PROCESS_YEAR(s->time->y, length);
1463 s->time->m = timelib_get_month((char **) &ptr);
1464 s->time->d = timelib_get_nr((char **) &ptr, 2);
1465 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1466 TIMELIB_PROCESS_YEAR(s->time->y, length);
1476 s->time->d = timelib_get_nr((char **) &ptr, 2);
1478 s->time->m = timelib_get_month((char **) &ptr);
1488 s->time->y = timelib_get_nr((char **) &ptr, 4);
1489 s->time->m = timelib_get_nr((char **) &ptr, 2);
1490 s->time->d = timelib_get_nr((char **) &ptr, 2);
1502 s->time->y = timelib_get_nr((char **) &ptr, 4);
1503 s->time->m = timelib_get_nr((char **) &ptr, 2);
1504 s->time->d = timelib_get_nr((char **) &ptr, 2);
1505 s->time->h = timelib_get_nr((char **) &ptr, 2);
1506 s->time->i = timelib_get_nr((char **) &ptr, 2);
1507 s->time->s = timelib_get_nr((char **) &ptr, 2);
1509 s->time->us = timelib_get_frac_nr((char **) &ptr, 9);
1511s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1513 add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
1527 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1528 s->time->d = timelib_get_nr((char **) &ptr, 3);
1529 s->time->m = 1;
1530 TIMELIB_PROCESS_YEAR(s->time->y, length);
1543 s->time->y = timelib_get_nr((char **) &ptr, 4);
1546 s->time->m = 1;
1547 s->time->d = 1;
1548 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1562 s->time->y = timelib_get_nr((char **) &ptr, 4);
1565 s->time->m = 1;
1566 s->time->d = 1;
1567 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1579 s->time->m = timelib_get_month((char **) &ptr);
1580 s->time->d = timelib_get_nr((char **) &ptr, 2);
1581 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1582 TIMELIB_PROCESS_YEAR(s->time->y, length);
1593 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1594 s->time->m = timelib_get_month((char **) &ptr);
1595 s->time->d = timelib_get_nr((char **) &ptr, 2);
1596 TIMELIB_PROCESS_YEAR(s->time->y, length);
1608 s->time->d = timelib_get_nr((char **) &ptr, 2);
1609 s->time->m = timelib_get_month((char **) &ptr);
1610 s->time->y = timelib_get_nr((char **) &ptr, 4);
1611 s->time->h = timelib_get_nr((char **) &ptr, 2);
1612 s->time->i = timelib_get_nr((char **) &ptr, 2);
1613 s->time->s = timelib_get_nr((char **) &ptr, 2);
1614s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1616 add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
1626 s->time->y = timelib_get_nr((char **) &ptr, 4);
1635 s->time->relative.y = 0 - s->time->relative.y;
1636 s->time->relative.m = 0 - s->time->relative.m;
1637 s->time->relative.d = 0 - s->time->relative.d;
1638 s->time->relative.h = 0 - s->time->relative.h;
1639 s->time->relative.i = 0 - s->time->relative.i;
1640 s->time->relative.s = 0 - s->time->relative.s;
1641 s->time->relative.weekday = 0 - s->time->relative.weekday;
1642 if (s->time->relative.weekday == 0) {
1643 s->time->relative.weekday = -7;
1645 …if (s->time->relative.have_special_relative && s->time->relative.special.type == TIMELIB_SPECIAL_W…
1646 s->time->relative.special.amount = 0 - s->time->relative.special.amount;
1661 s->time->relative.weekday = relunit->multiplier;
1662 if (s->time->relative.weekday_behavior != 2) {
1663 s->time->relative.weekday_behavior = 1;
1681 timelib_set_relative((char **) &ptr, i, behavior, s);
1682 s->time->relative.weekday_behavior = 2;
1685 if (s->time->relative.have_weekday_relative == 0) {
1687 s->time->relative.weekday = 1;
1705 timelib_set_relative((char **) &ptr, i, behavior, s);
1716 s->time->m = timelib_lookup_month((char **) &ptr);
1727s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1729 add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
1740 s->time->m = timelib_get_month((char **) &ptr);
1741 s->time->d = timelib_get_nr((char **) &ptr, 2);
1744 s->time->h = timelib_get_nr((char **) &ptr, 2);
1745 s->time->i = timelib_get_nr((char **) &ptr, 2);
1747 s->time->s = timelib_get_nr((char **) &ptr, 2);
1750 s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
1754 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1765 s->time->m = timelib_get_month((char **) &ptr);
1766 s->time->d = timelib_get_nr((char **) &ptr, 2);
1769 s->time->h = timelib_get_nr((char **) &ptr, 2);
1770 s->time->i = timelib_get_nr((char **) &ptr, 2);
1772 s->time->s = timelib_get_nr((char **) &ptr, 2);
1775 s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
1780s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1782 add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
1799 timelib_set_relative((char **) &ptr, i, 1, s);
1812 s->pos = cursor; s->line++;
1818 add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
1826 timelib_time* timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timeli…
1830 char *e = s + len - 1;
1840 while (isspace(*s) && s < e) {
1841 s++;
1843 while (isspace(*e) && e > s) {
1847 if (e - s < 0) {
1855 …in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->us = in.tim…
1861 in.str = timelib_malloc((e - s) + YYMAXFILL);
1862 memset(in.str, 0, (e - s) + YYMAXFILL);
1863 memcpy(in.str, s, (e - s));
1864 in.lim = in.str + (e - s) + YYMAXFILL;
1872 in.time->s = TIMELIB_UNSET;
1889 if (in.time->have_time && !timelib_valid_time( in.time->h, in.time->i, in.time->s)) {
1909 add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
1914 add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
1924 time->h = time->i = time->s = 0;
1938 if (time->s == TIMELIB_UNSET ) time->s = 0;
1965 {'s', TIMELIB_FORMAT_SECOND_TWO_DIGIT},
2018 Scanner *s = &in;
2040 in.time->s = TIMELIB_UNSET;
2064 … add_pbf_error(s, TIMELIB_ERR_FORMAT_LITERAL_MISMATCH, "Format literal not found", string, begin);
2091 … add_pbf_error(s, TIMELIB_ERR_NO_TEXTUAL_DAY, "A textual day could not be found", string, begin);
2104 if ((s->time->d = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
2105 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_DAY, "A two digit day could not be found", string, begin…
2114 …add_pbf_error(s, TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR, "A three digit day-of-year could not be f…
2116 s->time->m = 1;
2117 s->time->d = tmp + 1;
2118 timelib_do_normalize(s->time);
2125 if ((s->time->m = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
2126 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_MONTH, "A two digit month could not be found", string, b…
2133 …add_pbf_error(s, TIMELIB_ERR_NO_TEXTUAL_MONTH, "A textual month could not be found", string, begin…
2135 s->time->m = tmp;
2142 if ((s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length)) == TIMELIB_UNSET) {
2143 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_YEAR, "A two digit year could not be found", string, beg…
2145 TIMELIB_PROCESS_YEAR(s->time->y, length);
2150 if ((s->time->y = timelib_get_nr((char **) &ptr, 4)) == TIMELIB_UNSET) {
2151 …add_pbf_error(s, TIMELIB_ERR_NO_FOUR_DIGIT_YEAR, "A four digit year could not be found", string, b…
2157 if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
2158 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_HOUR, "A two digit hour could not be found", string, beg…
2160 if (s->time->h > 12) {
2161 …add_pbf_error(s, TIMELIB_ERR_HOUR_LARGER_THAN_12, "Hour can not be higher than 12", string, begin);
2167 if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
2168 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_HOUR, "A two digit hour could not be found", string, beg…
2172 if (s->time->h == TIMELIB_UNSET) {
2173 …add_pbf_error(s, TIMELIB_ERR_MERIDIAN_BEFORE_HOUR, "Meridian can only come after an hour has been …
2174 } else if ((tmp = timelib_meridian_with_check((char **) &ptr, s->time->h)) == TIMELIB_UNSET) {
2175 add_pbf_error(s, TIMELIB_ERR_NO_MERIDIAN, "A meridian could not be found", string, begin);
2177 s->time->h += tmp;
2188 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_MINUTE, "A two digit minute could not be found", string,…
2190 s->time->i = min;
2202 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_SECOND, "A two digit second could not be found", string,…
2204 s->time->s = sec;
2216 …add_pbf_error(s, TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND, "A six digit microsecond could not be found…
2218 s->time->us = (f * pow(10, 6 - (ptr - tptr)));
2230 …add_pbf_error(s, TIMELIB_ERR_NO_THREE_DIGIT_MILLISECOND, "A three digit millisecond could not be f…
2232 s->time->us = (f * pow(10, 3 - (ptr - tptr)) * 1000);
2243 s->time->y = 1970;
2244 s->time->m = 1;
2245 s->time->d = 1;
2246 s->time->h = s->time->i = s->time->s = 0;
2247 s->time->relative.s += tmp;
2248 s->time->is_localtime = 1;
2249 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
2250 s->time->z = 0;
2251 s->time->dst = 0;
2257 …add_pbf_error(s, TIMELIB_ERR_NO_SEP_SYMBOL, "The separation symbol ([;:/.,-]) could not be found",…
2265 …add_pbf_error(s, TIMELIB_ERR_NO_SEP_SYMBOL, "The separation symbol could not be found", string, be…
2270 timelib_time_reset_fields(s->time);
2274 timelib_time_reset_unset_fields(s->time);
2283 … add_pbf_error(s, TIMELIB_ERR_EXPECTED_ESCAPE_CHAR, "Escaped character expected", string, begin);
2290 …add_pbf_error(s, TIMELIB_ERR_NO_ESCAPED_CHAR, "The escaped character could not be found", string, …
2303 …add_pbf_error(s, TIMELIB_ERR_NO_FOUR_DIGIT_YEAR_ISO, "A four digit ISO year could not be found", s…
2308 …add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_WEEK, "A two digit ISO week could not be found", string,…
2312 add_pbf_error(s, TIMELIB_ERR_INVALID_WEEK, "ISO Week must be between 1 and 53", string, begin);
2317 …add_pbf_error(s, TIMELIB_ERR_NO_DAY_OF_WEEK, "A single digit day of week could not be found", stri…
2320 …add_pbf_error(s, TIMELIB_ERR_INVALID_DAY_OF_WEEK, "Day of week must be between 1 and 7", string, b…
2327s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
2329 …add_pbf_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database", st…
2334 s->time->z = timelib_parse_tz_minutes((char **) &ptr, s->time);
2335 if (s->time->z == TIMELIB_UNSET) {
2336 …add_pbf_error(s, TIMELIB_ERR_INVALID_TZ_OFFSET, "Invalid timezone offset in minutes", string, begi…
2342 …add_pbf_error(s, TIMELIB_ERR_WRONG_FORMAT_SEP, "The format separator does not match", string, begi…
2350 add_pbf_warning(s, TIMELIB_WARN_TRAILING_DATA, "Trailing data", string, ptr);
2352 add_pbf_error(s, TIMELIB_ERR_TRAILING_DATA, "Trailing data", string, ptr);
2362 timelib_time_reset_fields(s->time);
2366 timelib_time_reset_unset_fields(s->time);
2372 add_pbf_error(s, TIMELIB_ERR_DATA_MISSING, "Data missing", string, ptr);
2380 …if (s->time->h != TIMELIB_UNSET || s->time->i != TIMELIB_UNSET || s->time->s != TIMELIB_UNSET || s
2381 if (s->time->h == TIMELIB_UNSET ) {
2382 s->time->h = 0;
2384 if (s->time->i == TIMELIB_UNSET ) {
2385 s->time->i = 0;
2387 if (s->time->s == TIMELIB_UNSET ) {
2388 s->time->s = 0;
2390 if (s->time->us == TIMELIB_UNSET ) {
2391 s->time->us = 0;
2396 …if (s->time->y != TIMELIB_UNSET && (iso_week_of_year != TIMELIB_UNSET || iso_year != TIMELIB_UNSET…
2397 …add_pbf_error(s, TIMELIB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not …
2399 …if (iso_year != TIMELIB_UNSET && (s->time->y != TIMELIB_UNSET || s->time->m != TIMELIB_UNSET || s-…
2400 …add_pbf_error(s, TIMELIB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not …
2412 …ate_from_isodate(iso_year, iso_week_of_year, iso_day_of_week, &s->time->y, &s->time->m, &s->time->…
2414 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
2418 if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
2419 s->time->s != TIMELIB_UNSET &&
2420 !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
2421 add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
2424 if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
2425 s->time->d != TIMELIB_UNSET &&
2426 !timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
2427 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
2443 parsed->s = 0;
2448 parsed->h != TIMELIB_UNSET || parsed->i != TIMELIB_UNSET || parsed->s != TIMELIB_UNSET
2459 if (parsed->s == TIMELIB_UNSET) parsed->s = now->s != TIMELIB_UNSET ? now->s : 0;
2503 time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
2506 …e.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s);