Lines Matching refs:time

96time->have_time) { add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification"); timelib_str…
97 #define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s …
98 …>time->have_date) { add_error(s, TIMELIB_ERR_DOUBLE_DATE, "Double date specification"); timelib_st…
99 #define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y …
100 #define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
101 #define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_weekda…
102 #define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_specia…
103time->have_zone) { s->time->have_zone > 1 ? add_error(s, TIMELIB_ERR_DOUBLE_TZ, "Double timezone s…
107 #define TIMELIB_ADJUST_RELATIVE_WEEKDAY() if (in->time.have_weekday_relative && (in.rel.d > 0)) { i…
140 timelib_time *time;
731 * the time portion should not be reset to midnight, or
733 * for not overwriting the time portion for 'X weekday'.
744 …case TIMELIB_MICROSEC: add_with_overflow(s, &s->time->relative.us, amount, relunit->multiplier); b…
745 …case TIMELIB_SECOND: add_with_overflow(s, &s->time->relative.s, amount, relunit->multiplier); br…
746 …case TIMELIB_MINUTE: add_with_overflow(s, &s->time->relative.i, amount, relunit->multiplier); br…
747 …case TIMELIB_HOUR: add_with_overflow(s, &s->time->relative.h, amount, relunit->multiplier); br…
748 …case TIMELIB_DAY: add_with_overflow(s, &s->time->relative.d, amount, relunit->multiplier); br…
749 …case TIMELIB_MONTH: add_with_overflow(s, &s->time->relative.m, amount, relunit->multiplier); br…
750 …case TIMELIB_YEAR: add_with_overflow(s, &s->time->relative.y, amount, relunit->multiplier); br…
757 s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
758 s->time->relative.weekday = relunit->multiplier;
759 s->time->relative.weekday_behavior = behavior;
767 s->time->relative.special.type = relunit->multiplier;
768 s->time->relative.special.amount = amount;
1162 s->time->relative.d = -1;
1182 s->time->h = 12;
1205 s->time->relative.d = 1;
1221 s->time->y = 1970;
1222 s->time->m = 1;
1223 s->time->d = 1;
1224 s->time->h = s->time->i = s->time->s = 0;
1225 s->time->us = 0;
1226 s->time->relative.s += i;
1227 s->time->is_localtime = 1;
1228 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1229 s->time->z = 0;
1230 s->time->dst = 0;
1260 s->time->y = 1970;
1261 s->time->m = 1;
1262 s->time->d = 1;
1263 s->time->h = s->time->i = s->time->s = 0;
1264 s->time->us = 0;
1265 s->time->relative.s += i;
1266 s->time->relative.us = us;
1267 s->time->is_localtime = 1;
1268 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1269 s->time->z = 0;
1270 s->time->dst = 0;
1284 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_LAST_DAY_OF_MONTH;
1286 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH;
1301 s->time->h = timelib_get_nr(&ptr, 2);
1302 s->time->i = 15;
1304 s->time->h = timelib_get_nr(&ptr, 2) - 1;
1305 s->time->i = 45;
1309 s->time->h += timelib_meridian(&ptr, s->time->h);
1328 s->time->relative.special.type = TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH;
1331 s->time->relative.special.type = TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH;
1343 s->time->h = timelib_get_nr(&ptr, 2);
1345 s->time->i = timelib_get_nr(&ptr, 2);
1347 s->time->s = timelib_get_nr(&ptr, 2);
1351 s->time->h += timelib_meridian(&ptr, s->time->h);
1361 s->time->h = timelib_get_nr(&ptr, 2);
1362 s->time->i = timelib_get_nr(&ptr, 2);
1364 s->time->s = timelib_get_nr(&ptr, 2);
1367 s->time->us = timelib_get_frac_nr(&ptr);
1371 s->time->h += timelib_meridian(&ptr, s->time->h);
1382 s->time->h = timelib_get_nr(&ptr, 2);
1384 s->time->i = timelib_get_nr(&ptr, 2);
1386 s->time->s = timelib_get_nr(&ptr, 2);
1389 s->time->us = timelib_get_frac_nr(&ptr);
1395 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1408 switch (s->time->have_time) {
1410 s->time->h = timelib_get_nr(&ptr, 2);
1411 s->time->i = timelib_get_nr(&ptr, 2);
1412 s->time->s = 0;
1415 s->time->y = timelib_get_nr(&ptr, 4);
1419 add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification");
1422 s->time->have_time++;
1431 switch (s->time->have_time) {
1433 s->time->h = timelib_get_nr(&ptr, 2);
1434 s->time->i = timelib_get_nr(&ptr, 2);
1435 s->time->s = 0;
1436 s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1439 s->time->y = timelib_get_nr(&ptr, 4);
1445 s->time->have_time++;
1456 s->time->h = timelib_get_nr(&ptr, 2);
1457 s->time->i = timelib_get_nr(&ptr, 2);
1458 s->time->s = timelib_get_nr(&ptr, 2);
1461 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1476 s->time->m = timelib_get_nr(&ptr, 2);
1477 s->time->d = timelib_get_nr(&ptr, 2);
1479 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1480 TIMELIB_PROCESS_YEAR(s->time->y, length);
1491 s->time->y = timelib_get_signed_nr(s, &ptr, 4);
1492 s->time->m = timelib_get_nr(&ptr, 2);
1493 s->time->d = timelib_get_nr(&ptr, 2);
1504 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1505 s->time->m = timelib_get_nr(&ptr, 2);
1506 s->time->d = timelib_get_nr(&ptr, 2);
1507 TIMELIB_PROCESS_YEAR(s->time->y, length);
1517 s->time->y = timelib_get_signed_nr(s, &ptr, 19);
1518 s->time->m = timelib_get_nr(&ptr, 2);
1519 s->time->d = timelib_get_nr(&ptr, 2);
1530 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1531 s->time->m = timelib_get_nr(&ptr, 2);
1532 s->time->d = 1;
1533 TIMELIB_PROCESS_YEAR(s->time->y, length);
1544 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1545 s->time->m = timelib_get_nr(&ptr, 2);
1546 s->time->d = timelib_get_nr(&ptr, 2);
1547 TIMELIB_PROCESS_YEAR(s->time->y, length);
1558 s->time->d = timelib_get_nr(&ptr, 2);
1560 s->time->m = timelib_get_month(&ptr);
1561 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1562 TIMELIB_PROCESS_YEAR(s->time->y, length);
1572 s->time->d = timelib_get_nr(&ptr, 2);
1573 s->time->m = timelib_get_nr(&ptr, 2);
1574 s->time->y = timelib_get_nr(&ptr, 4);
1585 s->time->d = timelib_get_nr(&ptr, 2);
1586 s->time->m = timelib_get_nr(&ptr, 2);
1587 s->time->y = timelib_get_nr_ex(&ptr, 2, &length);
1588 TIMELIB_PROCESS_YEAR(s->time->y, length);
1599 s->time->m = timelib_get_month(&ptr);
1600 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1601 s->time->d = 1;
1602 TIMELIB_PROCESS_YEAR(s->time->y, length);
1613 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1614 s->time->m = timelib_get_month(&ptr);
1615 s->time->d = 1;
1616 TIMELIB_PROCESS_YEAR(s->time->y, length);
1627 s->time->m = timelib_get_month(&ptr);
1628 s->time->d = timelib_get_nr(&ptr, 2);
1629 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1630 TIMELIB_PROCESS_YEAR(s->time->y, length);
1640 s->time->d = timelib_get_nr(&ptr, 2);
1642 s->time->m = timelib_get_month(&ptr);
1652 s->time->y = timelib_get_nr(&ptr, 4);
1653 s->time->m = timelib_get_nr(&ptr, 2);
1654 s->time->d = timelib_get_nr(&ptr, 2);
1666 s->time->y = timelib_get_nr(&ptr, 4);
1667 s->time->m = timelib_get_nr(&ptr, 2);
1668 s->time->d = timelib_get_nr(&ptr, 2);
1669 s->time->h = timelib_get_nr(&ptr, 2);
1670 s->time->i = timelib_get_nr(&ptr, 2);
1671 s->time->s = timelib_get_nr(&ptr, 2);
1673 s->time->us = timelib_get_frac_nr(&ptr);
1675 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1691 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1692 s->time->d = timelib_get_nr(&ptr, 3);
1693 s->time->m = 1;
1694 TIMELIB_PROCESS_YEAR(s->time->y, length);
1707 s->time->y = timelib_get_nr(&ptr, 4);
1710 s->time->m = 1;
1711 s->time->d = 1;
1712 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1726 s->time->y = timelib_get_nr(&ptr, 4);
1729 s->time->m = 1;
1730 s->time->d = 1;
1731 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1743 s->time->m = timelib_get_month(&ptr);
1744 s->time->d = timelib_get_nr(&ptr, 2);
1745 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1746 TIMELIB_PROCESS_YEAR(s->time->y, length);
1757 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1758 s->time->m = timelib_get_month(&ptr);
1759 s->time->d = timelib_get_nr(&ptr, 2);
1760 TIMELIB_PROCESS_YEAR(s->time->y, length);
1772 s->time->d = timelib_get_nr(&ptr, 2);
1773 s->time->m = timelib_get_month(&ptr);
1774 s->time->y = timelib_get_nr(&ptr, 4);
1775 s->time->h = timelib_get_nr(&ptr, 2);
1776 s->time->i = timelib_get_nr(&ptr, 2);
1777 s->time->s = timelib_get_nr(&ptr, 2);
1781 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1793 s->time->y = timelib_get_nr(&ptr, 4);
1802 s->time->relative.y = 0 - s->time->relative.y;
1803 s->time->relative.m = 0 - s->time->relative.m;
1804 s->time->relative.d = 0 - s->time->relative.d;
1805 s->time->relative.h = 0 - s->time->relative.h;
1806 s->time->relative.i = 0 - s->time->relative.i;
1807 s->time->relative.s = 0 - s->time->relative.s;
1808 s->time->relative.weekday = 0 - s->time->relative.weekday;
1809 if (s->time->relative.weekday == 0) {
1810 s->time->relative.weekday = -7;
1812 …if (s->time->relative.have_special_relative && s->time->relative.special.type == TIMELIB_SPECIAL_W…
1813 s->time->relative.special.amount = 0 - s->time->relative.special.amount;
1828 s->time->relative.weekday = relunit->multiplier;
1829 if (s->time->relative.weekday_behavior != 2) {
1830 s->time->relative.weekday_behavior = 1;
1849 s->time->relative.weekday_behavior = 2;
1852 if (s->time->relative.have_weekday_relative == 0) {
1854 s->time->relative.weekday = 1;
1883 s->time->m = timelib_lookup_month(&ptr);
1895 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1908 s->time->m = timelib_get_month(&ptr);
1909 s->time->d = timelib_get_nr(&ptr, 2);
1912 s->time->h = timelib_get_nr(&ptr, 2);
1913 s->time->i = timelib_get_nr(&ptr, 2);
1915 s->time->s = timelib_get_nr(&ptr, 2);
1918 s->time->us = timelib_get_frac_nr(&ptr);
1922 s->time->h += timelib_meridian(&ptr, s->time->h);
1933 s->time->m = timelib_get_month(&ptr);
1934 s->time->d = timelib_get_nr(&ptr, 2);
1937 s->time->h = timelib_get_nr(&ptr, 2);
1938 s->time->i = timelib_get_nr(&ptr, 2);
1940 s->time->s = timelib_get_nr(&ptr, 2);
1943 s->time->us = timelib_get_frac_nr(&ptr);
1948 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
2021 in.time = timelib_time_ctor();
2028 …in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->us = in.tim…
2029 in.time->is_localtime = in.time->zone_type = 0;
2030 return in.time;
2039 in.time = timelib_time_ctor();
2040 in.time->y = TIMELIB_UNSET;
2041 in.time->d = TIMELIB_UNSET;
2042 in.time->m = TIMELIB_UNSET;
2043 in.time->h = TIMELIB_UNSET;
2044 in.time->i = TIMELIB_UNSET;
2045 in.time->s = TIMELIB_UNSET;
2046 in.time->us = TIMELIB_UNSET;
2047 in.time->z = TIMELIB_UNSET;
2048 in.time->dst = TIMELIB_UNSET;
2050 in.time->is_localtime = 0;
2051 in.time->zone_type = 0;
2052 in.time->relative.days = TIMELIB_UNSET;
2061 /* do funky checking whether the parsed time was valid time */
2062 if (in.time->have_time && !timelib_valid_time( in.time->h, in.time->i, in.time->s)) {
2063 add_warning(&in, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid");
2066 if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) {
2076 return in.time;
2090 static void timelib_time_reset_fields(timelib_time *time)
2092 assert(time != NULL);
2094 time->y = 1970;
2095 time->m = 1;
2096 time->d = 1;
2097 time->h = time->i = time->s = 0;
2098 time->us = 0;
2099 time->tz_info = NULL;
2102 static void timelib_time_reset_unset_fields(timelib_time *time)
2104 assert(time != NULL);
2106 if (time->y == TIMELIB_UNSET ) time->y = 1970;
2107 if (time->m == TIMELIB_UNSET ) time->m = 1;
2108 if (time->d == TIMELIB_UNSET ) time->d = 1;
2109 if (time->h == TIMELIB_UNSET ) time->h = 0;
2110 if (time->i == TIMELIB_UNSET ) time->i = 0;
2111 if (time->s == TIMELIB_UNSET ) time->s = 0;
2112 if (time->us == TIMELIB_UNSET ) time->us = 0;
2210 in.time = timelib_time_ctor();
2211 in.time->y = TIMELIB_UNSET;
2212 in.time->d = TIMELIB_UNSET;
2213 in.time->m = TIMELIB_UNSET;
2214 in.time->h = TIMELIB_UNSET;
2215 in.time->i = TIMELIB_UNSET;
2216 in.time->s = TIMELIB_UNSET;
2217 in.time->us = TIMELIB_UNSET;
2218 in.time->z = TIMELIB_UNSET;
2219 in.time->dst = TIMELIB_UNSET;
2221 in.time->is_localtime = 0;
2222 in.time->zone_type = 0;
2270 in.time->have_relative = 1;
2271 in.time->relative.have_weekday_relative = 1;
2272 in.time->relative.weekday = tmprel->multiplier;
2273 in.time->relative.weekday_behavior = 1;
2280 if ((s->time->d = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2285 s->time->have_date = 1;
2292 if (s->time->y == TIMELIB_UNSET) {
2300 if (s->time->y != TIMELIB_UNSET) {
2301 s->time->have_date = 1;
2302 s->time->m = 1;
2303 s->time->d = tmp + 1;
2304 timelib_do_normalize(s->time);
2311 if ((s->time->m = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2315 s->time->have_date = 1;
2325 s->time->have_date = 1;
2326 s->time->m = tmp;
2332 if ((s->time->y = timelib_get_nr_ex(&ptr, 2, &length)) == TIMELIB_UNSET) {
2337 s->time->have_date = 1;
2338 TIMELIB_PROCESS_YEAR(s->time->y, length);
2343 if ((s->time->y = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2348 s->time->have_date = 1;
2352 if ((s->time->y = timelib_get_signed_nr(s, &ptr, 19)) == TIMELIB_UNSET) {
2357 s->time->have_date = 1;
2362 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2366 if (s->time->h > 12) {
2371 s->time->have_time = 1;
2376 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2381 s->time->have_time = 1;
2384 if (s->time->h == TIMELIB_UNSET) {
2387 if ((tmp = timelib_meridian_with_check(&ptr, s->time->h)) == TIMELIB_UNSET) {
2392 s->time->have_time = 1;
2393 if (s->time->h != TIMELIB_UNSET) {
2394 s->time->h += tmp;
2409 s->time->have_time = 1;
2410 s->time->i = min;
2425 s->time->have_time = 1;
2426 s->time->s = sec;
2441 s->time->us = (f * pow(10, 6 - (ptr - tptr)));
2456 s->time->us = (f * pow(10, 3 - (ptr - tptr)) * 1000);
2465 s->time->have_zone = 1;
2466 s->time->sse = tmp;
2467 s->time->is_localtime = 1;
2468 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
2469 s->time->z = 0;
2470 s->time->dst = 0;
2471 timelib_update_from_sse(s->time);
2493 timelib_time_reset_fields(s->time);
2497 timelib_time_reset_unset_fields(s->time);
2531 s->time->have_date = 1;
2544 s->time->have_date = 1;
2556 s->time->have_date = 1;
2562 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
2568 s->time->have_zone = 1;
2572 s->time->z = timelib_parse_tz_minutes(&ptr, s->time);
2573 if (s->time->z == TIMELIB_UNSET) {
2578 s->time->have_zone = 1;
2603 timelib_time_reset_fields(s->time);
2607 timelib_time_reset_unset_fields(s->time);
2621 …if (s->time->h != TIMELIB_UNSET || s->time->i != TIMELIB_UNSET || s->time->s != TIMELIB_UNSET || s…
2622 if (s->time->h == TIMELIB_UNSET ) {
2623 s->time->h = 0;
2625 if (s->time->i == TIMELIB_UNSET ) {
2626 s->time->i = 0;
2628 if (s->time->s == TIMELIB_UNSET ) {
2629 s->time->s = 0;
2631 if (s->time->us == TIMELIB_UNSET ) {
2632 s->time->us = 0;
2637 …if (s->time->y != TIMELIB_UNSET && (iso_week_of_year != TIMELIB_UNSET || iso_year != TIMELIB_UNSET…
2640 …if (iso_year != TIMELIB_UNSET && (s->time->y != TIMELIB_UNSET || s->time->m != TIMELIB_UNSET || s-…
2653 …e_from_isodate(iso_year, iso_week_of_year, iso_day_of_week, &s->time->y, &s->time->m, &s->time->d);
2658 /* do funky checking whether the parsed time was valid time */
2659 if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
2660 s->time->s != TIMELIB_UNSET &&
2661 !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
2662 add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
2665 if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
2666 s->time->d != TIMELIB_UNSET &&
2667 !timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
2676 return in.time;
2744 timelib_time time = timelib_strtotime("May 12");
2747 time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
2748 if (time.have_relative) {
2750time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative…
2752 if (time.have_weekday_relative) {
2753 printf (" / %d", time.relative.weekday);
2755 if (time.have_weeknr_day) {
2756 printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);