Lines Matching refs:time
95 …time->have_time) { add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification"); timelib_str…
96 #define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s …
97 …>time->have_date) { add_error(s, TIMELIB_ERR_DOUBLE_DATE, "Double date specification"); timelib_st…
98 #define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y …
99 #define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
100 #define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_weekda…
101 #define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_specia…
102 …time->have_zone) { s->time->have_zone > 1 ? add_error(s, TIMELIB_ERR_DOUBLE_TZ, "Double timezone s…
106 #define TIMELIB_ADJUST_RELATIVE_WEEKDAY() if (in->time.have_weekday_relative && (in.rel.d > 0)) { i…
139 timelib_time *time;
671 * the time portion should not be reset to midnight, or
673 * for not overwriting the time portion for 'X weekday'.
684 case TIMELIB_MICROSEC: s->time->relative.us += amount * relunit->multiplier; break;
685 case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
686 case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
687 case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
688 case TIMELIB_DAY: s->time->relative.d += amount * relunit->multiplier; break;
689 case TIMELIB_MONTH: s->time->relative.m += amount * relunit->multiplier; break;
690 case TIMELIB_YEAR: s->time->relative.y += amount * relunit->multiplier; break;
697 s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
698 s->time->relative.weekday = relunit->multiplier;
699 s->time->relative.weekday_behavior = behavior;
707 s->time->relative.special.type = relunit->multiplier;
708 s->time->relative.special.amount = amount;
1100 s->time->relative.d = -1;
1120 s->time->h = 12;
1143 s->time->relative.d = 1;
1159 s->time->y = 1970;
1160 s->time->m = 1;
1161 s->time->d = 1;
1162 s->time->h = s->time->i = s->time->s = 0;
1163 s->time->us = 0;
1164 s->time->relative.s += i;
1165 s->time->is_localtime = 1;
1166 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1167 s->time->z = 0;
1168 s->time->dst = 0;
1198 s->time->y = 1970;
1199 s->time->m = 1;
1200 s->time->d = 1;
1201 s->time->h = s->time->i = s->time->s = 0;
1202 s->time->us = 0;
1203 s->time->relative.s += i;
1204 s->time->relative.us = us;
1205 s->time->is_localtime = 1;
1206 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1207 s->time->z = 0;
1208 s->time->dst = 0;
1222 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_LAST_DAY_OF_MONTH;
1224 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH;
1239 s->time->h = timelib_get_nr(&ptr, 2);
1240 s->time->i = 15;
1242 s->time->h = timelib_get_nr(&ptr, 2) - 1;
1243 s->time->i = 45;
1247 s->time->h += timelib_meridian(&ptr, s->time->h);
1266 s->time->relative.special.type = TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH;
1269 s->time->relative.special.type = TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH;
1281 s->time->h = timelib_get_nr(&ptr, 2);
1283 s->time->i = timelib_get_nr(&ptr, 2);
1285 s->time->s = timelib_get_nr(&ptr, 2);
1288 s->time->h += timelib_meridian(&ptr, s->time->h);
1298 s->time->h = timelib_get_nr(&ptr, 2);
1299 s->time->i = timelib_get_nr(&ptr, 2);
1301 s->time->s = timelib_get_nr(&ptr, 2);
1304 s->time->us = timelib_get_frac_nr(&ptr);
1308 s->time->h += timelib_meridian(&ptr, s->time->h);
1319 s->time->h = timelib_get_nr(&ptr, 2);
1321 s->time->i = timelib_get_nr(&ptr, 2);
1323 s->time->s = timelib_get_nr(&ptr, 2);
1326 s->time->us = timelib_get_frac_nr(&ptr);
1332 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1345 switch (s->time->have_time) {
1347 s->time->h = timelib_get_nr(&ptr, 2);
1348 s->time->i = timelib_get_nr(&ptr, 2);
1349 s->time->s = 0;
1352 s->time->y = timelib_get_nr(&ptr, 4);
1356 add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification");
1359 s->time->have_time++;
1368 switch (s->time->have_time) {
1370 s->time->h = timelib_get_nr(&ptr, 2);
1371 s->time->i = timelib_get_nr(&ptr, 2);
1372 s->time->s = 0;
1373 s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1376 s->time->y = timelib_get_nr(&ptr, 4);
1382 s->time->have_time++;
1393 s->time->h = timelib_get_nr(&ptr, 2);
1394 s->time->i = timelib_get_nr(&ptr, 2);
1395 s->time->s = timelib_get_nr(&ptr, 2);
1398 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1413 s->time->m = timelib_get_nr(&ptr, 2);
1414 s->time->d = timelib_get_nr(&ptr, 2);
1416 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1417 TIMELIB_PROCESS_YEAR(s->time->y, length);
1428 s->time->y = timelib_get_signed_nr(s, &ptr, 4);
1429 s->time->m = timelib_get_nr(&ptr, 2);
1430 s->time->d = timelib_get_nr(&ptr, 2);
1441 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1442 s->time->m = timelib_get_nr(&ptr, 2);
1443 s->time->d = timelib_get_nr(&ptr, 2);
1444 TIMELIB_PROCESS_YEAR(s->time->y, length);
1454 s->time->y = timelib_get_signed_nr(s, &ptr, 19);
1455 s->time->m = timelib_get_nr(&ptr, 2);
1456 s->time->d = timelib_get_nr(&ptr, 2);
1467 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1468 s->time->m = timelib_get_nr(&ptr, 2);
1469 s->time->d = 1;
1470 TIMELIB_PROCESS_YEAR(s->time->y, length);
1481 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1482 s->time->m = timelib_get_nr(&ptr, 2);
1483 s->time->d = timelib_get_nr(&ptr, 2);
1484 TIMELIB_PROCESS_YEAR(s->time->y, length);
1495 s->time->d = timelib_get_nr(&ptr, 2);
1497 s->time->m = timelib_get_month(&ptr);
1498 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1499 TIMELIB_PROCESS_YEAR(s->time->y, length);
1509 s->time->d = timelib_get_nr(&ptr, 2);
1510 s->time->m = timelib_get_nr(&ptr, 2);
1511 s->time->y = timelib_get_nr(&ptr, 4);
1522 s->time->d = timelib_get_nr(&ptr, 2);
1523 s->time->m = timelib_get_nr(&ptr, 2);
1524 s->time->y = timelib_get_nr_ex(&ptr, 2, &length);
1525 TIMELIB_PROCESS_YEAR(s->time->y, length);
1536 s->time->m = timelib_get_month(&ptr);
1537 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1538 s->time->d = 1;
1539 TIMELIB_PROCESS_YEAR(s->time->y, length);
1550 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1551 s->time->m = timelib_get_month(&ptr);
1552 s->time->d = 1;
1553 TIMELIB_PROCESS_YEAR(s->time->y, length);
1564 s->time->m = timelib_get_month(&ptr);
1565 s->time->d = timelib_get_nr(&ptr, 2);
1566 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1567 TIMELIB_PROCESS_YEAR(s->time->y, length);
1577 s->time->d = timelib_get_nr(&ptr, 2);
1579 s->time->m = timelib_get_month(&ptr);
1589 s->time->y = timelib_get_nr(&ptr, 4);
1590 s->time->m = timelib_get_nr(&ptr, 2);
1591 s->time->d = timelib_get_nr(&ptr, 2);
1603 s->time->y = timelib_get_nr(&ptr, 4);
1604 s->time->m = timelib_get_nr(&ptr, 2);
1605 s->time->d = timelib_get_nr(&ptr, 2);
1606 s->time->h = timelib_get_nr(&ptr, 2);
1607 s->time->i = timelib_get_nr(&ptr, 2);
1608 s->time->s = timelib_get_nr(&ptr, 2);
1610 s->time->us = timelib_get_frac_nr(&ptr);
1612 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1628 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1629 s->time->d = timelib_get_nr(&ptr, 3);
1630 s->time->m = 1;
1631 TIMELIB_PROCESS_YEAR(s->time->y, length);
1644 s->time->y = timelib_get_nr(&ptr, 4);
1647 s->time->m = 1;
1648 s->time->d = 1;
1649 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1663 s->time->y = timelib_get_nr(&ptr, 4);
1666 s->time->m = 1;
1667 s->time->d = 1;
1668 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1680 s->time->m = timelib_get_month(&ptr);
1681 s->time->d = timelib_get_nr(&ptr, 2);
1682 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1683 TIMELIB_PROCESS_YEAR(s->time->y, length);
1694 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1695 s->time->m = timelib_get_month(&ptr);
1696 s->time->d = timelib_get_nr(&ptr, 2);
1697 TIMELIB_PROCESS_YEAR(s->time->y, length);
1709 s->time->d = timelib_get_nr(&ptr, 2);
1710 s->time->m = timelib_get_month(&ptr);
1711 s->time->y = timelib_get_nr(&ptr, 4);
1712 s->time->h = timelib_get_nr(&ptr, 2);
1713 s->time->i = timelib_get_nr(&ptr, 2);
1714 s->time->s = timelib_get_nr(&ptr, 2);
1715 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1727 s->time->y = timelib_get_nr(&ptr, 4);
1736 s->time->relative.y = 0 - s->time->relative.y;
1737 s->time->relative.m = 0 - s->time->relative.m;
1738 s->time->relative.d = 0 - s->time->relative.d;
1739 s->time->relative.h = 0 - s->time->relative.h;
1740 s->time->relative.i = 0 - s->time->relative.i;
1741 s->time->relative.s = 0 - s->time->relative.s;
1742 s->time->relative.weekday = 0 - s->time->relative.weekday;
1743 if (s->time->relative.weekday == 0) {
1744 s->time->relative.weekday = -7;
1746 …if (s->time->relative.have_special_relative && s->time->relative.special.type == TIMELIB_SPECIAL_W…
1747 s->time->relative.special.amount = 0 - s->time->relative.special.amount;
1762 s->time->relative.weekday = relunit->multiplier;
1763 if (s->time->relative.weekday_behavior != 2) {
1764 s->time->relative.weekday_behavior = 1;
1783 s->time->relative.weekday_behavior = 2;
1786 if (s->time->relative.have_weekday_relative == 0) {
1788 s->time->relative.weekday = 1;
1817 s->time->m = timelib_lookup_month(&ptr);
1828 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1841 s->time->m = timelib_get_month(&ptr);
1842 s->time->d = timelib_get_nr(&ptr, 2);
1845 s->time->h = timelib_get_nr(&ptr, 2);
1846 s->time->i = timelib_get_nr(&ptr, 2);
1848 s->time->s = timelib_get_nr(&ptr, 2);
1851 s->time->us = timelib_get_frac_nr(&ptr);
1855 s->time->h += timelib_meridian(&ptr, s->time->h);
1866 s->time->m = timelib_get_month(&ptr);
1867 s->time->d = timelib_get_nr(&ptr, 2);
1870 s->time->h = timelib_get_nr(&ptr, 2);
1871 s->time->i = timelib_get_nr(&ptr, 2);
1873 s->time->s = timelib_get_nr(&ptr, 2);
1876 s->time->us = timelib_get_frac_nr(&ptr);
1881 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1949 in.time = timelib_time_ctor();
1956 …in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->us = in.tim…
1957 in.time->is_localtime = in.time->zone_type = 0;
1958 return in.time;
1967 in.time = timelib_time_ctor();
1968 in.time->y = TIMELIB_UNSET;
1969 in.time->d = TIMELIB_UNSET;
1970 in.time->m = TIMELIB_UNSET;
1971 in.time->h = TIMELIB_UNSET;
1972 in.time->i = TIMELIB_UNSET;
1973 in.time->s = TIMELIB_UNSET;
1974 in.time->us = TIMELIB_UNSET;
1975 in.time->z = TIMELIB_UNSET;
1976 in.time->dst = TIMELIB_UNSET;
1978 in.time->is_localtime = 0;
1979 in.time->zone_type = 0;
1980 in.time->relative.days = TIMELIB_UNSET;
1989 /* do funky checking whether the parsed time was valid time */
1990 if (in.time->have_time && !timelib_valid_time( in.time->h, in.time->i, in.time->s)) {
1991 add_warning(&in, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid");
1994 if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) {
2004 return in.time;
2018 static void timelib_time_reset_fields(timelib_time *time)
2020 assert(time != NULL);
2022 time->y = 1970;
2023 time->m = 1;
2024 time->d = 1;
2025 time->h = time->i = time->s = 0;
2026 time->us = 0;
2027 time->tz_info = NULL;
2030 static void timelib_time_reset_unset_fields(timelib_time *time)
2032 assert(time != NULL);
2034 if (time->y == TIMELIB_UNSET ) time->y = 1970;
2035 if (time->m == TIMELIB_UNSET ) time->m = 1;
2036 if (time->d == TIMELIB_UNSET ) time->d = 1;
2037 if (time->h == TIMELIB_UNSET ) time->h = 0;
2038 if (time->i == TIMELIB_UNSET ) time->i = 0;
2039 if (time->s == TIMELIB_UNSET ) time->s = 0;
2040 if (time->us == TIMELIB_UNSET ) time->us = 0;
2136 in.time = timelib_time_ctor();
2137 in.time->y = TIMELIB_UNSET;
2138 in.time->d = TIMELIB_UNSET;
2139 in.time->m = TIMELIB_UNSET;
2140 in.time->h = TIMELIB_UNSET;
2141 in.time->i = TIMELIB_UNSET;
2142 in.time->s = TIMELIB_UNSET;
2143 in.time->us = TIMELIB_UNSET;
2144 in.time->z = TIMELIB_UNSET;
2145 in.time->dst = TIMELIB_UNSET;
2147 in.time->is_localtime = 0;
2148 in.time->zone_type = 0;
2196 in.time->have_relative = 1;
2197 in.time->relative.have_weekday_relative = 1;
2198 in.time->relative.weekday = tmprel->multiplier;
2199 in.time->relative.weekday_behavior = 1;
2206 if ((s->time->d = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2211 s->time->have_date = 1;
2218 if (s->time->y == TIMELIB_UNSET) {
2226 if (s->time->y != TIMELIB_UNSET) {
2227 s->time->have_date = 1;
2228 s->time->m = 1;
2229 s->time->d = tmp + 1;
2230 timelib_do_normalize(s->time);
2237 if ((s->time->m = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2241 s->time->have_date = 1;
2251 s->time->have_date = 1;
2252 s->time->m = tmp;
2258 if ((s->time->y = timelib_get_nr_ex(&ptr, 2, &length)) == TIMELIB_UNSET) {
2263 s->time->have_date = 1;
2264 TIMELIB_PROCESS_YEAR(s->time->y, length);
2269 if ((s->time->y = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2274 s->time->have_date = 1;
2279 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2283 if (s->time->h > 12) {
2288 s->time->have_time = 1;
2293 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2298 s->time->have_time = 1;
2301 if (s->time->h == TIMELIB_UNSET) {
2304 if ((tmp = timelib_meridian_with_check(&ptr, s->time->h)) == TIMELIB_UNSET) {
2309 s->time->have_time = 1;
2310 if (s->time->h != TIMELIB_UNSET) {
2311 s->time->h += tmp;
2326 s->time->have_time = 1;
2327 s->time->i = min;
2342 s->time->have_time = 1;
2343 s->time->s = sec;
2358 s->time->us = (f * pow(10, 6 - (ptr - tptr)));
2373 s->time->us = (f * pow(10, 3 - (ptr - tptr)) * 1000);
2382 s->time->have_zone = 1;
2383 s->time->sse = tmp;
2384 s->time->is_localtime = 1;
2385 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
2386 s->time->z = 0;
2387 s->time->dst = 0;
2388 timelib_update_from_sse(s->time);
2410 timelib_time_reset_fields(s->time);
2414 timelib_time_reset_unset_fields(s->time);
2448 s->time->have_date = 1;
2461 s->time->have_date = 1;
2473 s->time->have_date = 1;
2479 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
2485 s->time->have_zone = 1;
2489 s->time->z = timelib_parse_tz_minutes(&ptr, s->time);
2490 if (s->time->z == TIMELIB_UNSET) {
2495 s->time->have_zone = 1;
2520 timelib_time_reset_fields(s->time);
2524 timelib_time_reset_unset_fields(s->time);
2538 …if (s->time->h != TIMELIB_UNSET || s->time->i != TIMELIB_UNSET || s->time->s != TIMELIB_UNSET || s…
2539 if (s->time->h == TIMELIB_UNSET ) {
2540 s->time->h = 0;
2542 if (s->time->i == TIMELIB_UNSET ) {
2543 s->time->i = 0;
2545 if (s->time->s == TIMELIB_UNSET ) {
2546 s->time->s = 0;
2548 if (s->time->us == TIMELIB_UNSET ) {
2549 s->time->us = 0;
2554 …if (s->time->y != TIMELIB_UNSET && (iso_week_of_year != TIMELIB_UNSET || iso_year != TIMELIB_UNSET…
2557 …if (iso_year != TIMELIB_UNSET && (s->time->y != TIMELIB_UNSET || s->time->m != TIMELIB_UNSET || s-…
2570 …e_from_isodate(iso_year, iso_week_of_year, iso_day_of_week, &s->time->y, &s->time->m, &s->time->d);
2575 /* do funky checking whether the parsed time was valid time */
2576 if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
2577 s->time->s != TIMELIB_UNSET &&
2578 !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
2579 add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
2582 if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
2583 s->time->d != TIMELIB_UNSET &&
2584 !timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
2593 return in.time;
2661 timelib_time time = timelib_strtotime("May 12");
2664 time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
2665 if (time.have_relative) {
2667 …time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative…
2669 if (time.have_weekday_relative) {
2670 printf (" / %d", time.relative.weekday);
2672 if (time.have_weeknr_day) {
2673 printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);