Lines Matching refs:time
116 …time->have_time) { add_error(s, "Double time specification"); timelib_string_free(str); return TIM…
117 #define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s …
118 …E() { if (s->time->have_date) { add_error(s, "Double date specification"); timelib_string_free(str…
119 #define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y …
120 #define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
121 #define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_weekda…
122 #define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_specia…
123 …time->have_zone) { s->time->have_zone > 1 ? add_error(s, "Double timezone specification") : add_wa…
127 #define TIMELIB_ADJUST_RELATIVE_WEEKDAY() if (in->time.have_weekday_relative && (in.rel.d > 0)) { i…
162 struct timelib_time *time;
671 …case TIMELIB_MICROSEC: s->time->relative.f += (((double) amount * (double) relunit->multiplier) / …
672 case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
673 case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
674 case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
675 case TIMELIB_DAY: s->time->relative.d += amount * relunit->multiplier; break;
676 case TIMELIB_MONTH: s->time->relative.m += amount * relunit->multiplier; break;
677 case TIMELIB_YEAR: s->time->relative.y += amount * relunit->multiplier; break;
682 s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
683 s->time->relative.weekday = relunit->multiplier;
684 s->time->relative.weekday_behavior = behavior;
690 s->time->relative.special.type = relunit->multiplier;
691 s->time->relative.special.amount = amount;
976 s->time->relative.d = -1;
996 s->time->h = 12;
1019 s->time->relative.d = 1;
1035 s->time->y = 1970;
1036 s->time->m = 1;
1037 s->time->d = 1;
1038 s->time->h = s->time->i = s->time->s = 0;
1039 s->time->f = 0.0;
1040 s->time->relative.s += i;
1041 s->time->is_localtime = 1;
1042 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1043 s->time->z = 0;
1044 s->time->dst = 0;
1062 s->time->y = 1970;
1063 s->time->m = 1;
1064 s->time->d = 1;
1065 s->time->h = s->time->i = s->time->s = 0;
1066 s->time->f = 0.0;
1067 s->time->relative.s += i;
1068 s->time->relative.f = ((double) ms) / 1000000.0;
1069 s->time->is_localtime = 1;
1070 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
1071 s->time->z = 0;
1072 s->time->dst = 0;
1086 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_LAST_DAY_OF_MONTH;
1088 s->time->relative.first_last_day_of = TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH;
1103 s->time->h = timelib_get_nr((char **) &ptr, 2);
1104 s->time->i = 15;
1106 s->time->h = timelib_get_nr((char **) &ptr, 2) - 1;
1107 s->time->i = 45;
1111 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1130 s->time->relative.special.type = TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH;
1133 s->time->relative.special.type = TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH;
1145 s->time->h = timelib_get_nr((char **) &ptr, 2);
1147 s->time->i = timelib_get_nr((char **) &ptr, 2);
1149 s->time->s = timelib_get_nr((char **) &ptr, 2);
1152 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1162 s->time->h = timelib_get_nr((char **) &ptr, 2);
1163 s->time->i = timelib_get_nr((char **) &ptr, 2);
1165 s->time->s = timelib_get_nr((char **) &ptr, 2);
1168 s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
1172 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1183 s->time->h = timelib_get_nr((char **) &ptr, 2);
1184 s->time->i = timelib_get_nr((char **) &ptr, 2);
1186 s->time->s = timelib_get_nr((char **) &ptr, 2);
1189 s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
1194 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1207 switch (s->time->have_time) {
1209 s->time->h = timelib_get_nr((char **) &ptr, 2);
1210 s->time->i = timelib_get_nr((char **) &ptr, 2);
1211 s->time->s = 0;
1214 s->time->y = timelib_get_nr((char **) &ptr, 4);
1218 add_error(s, "Double time specification");
1221 s->time->have_time++;
1230 switch (s->time->have_time) {
1232 s->time->h = timelib_get_nr((char **) &ptr, 2);
1233 s->time->i = timelib_get_nr((char **) &ptr, 2);
1234 s->time->s = 0;
1235 … s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1238 s->time->y = timelib_get_nr((char **) &ptr, 4);
1244 s->time->have_time++;
1255 s->time->h = timelib_get_nr((char **) &ptr, 2);
1256 s->time->i = timelib_get_nr((char **) &ptr, 2);
1257 s->time->s = timelib_get_nr((char **) &ptr, 2);
1260 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1275 s->time->m = timelib_get_nr((char **) &ptr, 2);
1276 s->time->d = timelib_get_nr((char **) &ptr, 2);
1278 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1279 TIMELIB_PROCESS_YEAR(s->time->y, length);
1290 s->time->y = timelib_get_unsigned_nr((char **) &ptr, 4);
1291 s->time->m = timelib_get_nr((char **) &ptr, 2);
1292 s->time->d = timelib_get_nr((char **) &ptr, 2);
1303 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1304 s->time->m = timelib_get_nr((char **) &ptr, 2);
1305 s->time->d = timelib_get_nr((char **) &ptr, 2);
1306 TIMELIB_PROCESS_YEAR(s->time->y, length);
1317 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1318 s->time->m = timelib_get_nr((char **) &ptr, 2);
1319 s->time->d = 1;
1320 TIMELIB_PROCESS_YEAR(s->time->y, length);
1331 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1332 s->time->m = timelib_get_nr((char **) &ptr, 2);
1333 s->time->d = timelib_get_nr((char **) &ptr, 2);
1334 TIMELIB_PROCESS_YEAR(s->time->y, length);
1345 s->time->d = timelib_get_nr((char **) &ptr, 2);
1347 s->time->m = timelib_get_month((char **) &ptr);
1348 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1349 TIMELIB_PROCESS_YEAR(s->time->y, length);
1359 s->time->d = timelib_get_nr((char **) &ptr, 2);
1360 s->time->m = timelib_get_nr((char **) &ptr, 2);
1361 s->time->y = timelib_get_nr((char **) &ptr, 4);
1372 s->time->d = timelib_get_nr((char **) &ptr, 2);
1373 s->time->m = timelib_get_nr((char **) &ptr, 2);
1374 s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length);
1375 TIMELIB_PROCESS_YEAR(s->time->y, length);
1386 s->time->m = timelib_get_month((char **) &ptr);
1387 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1388 s->time->d = 1;
1389 TIMELIB_PROCESS_YEAR(s->time->y, length);
1400 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1401 s->time->m = timelib_get_month((char **) &ptr);
1402 s->time->d = 1;
1403 TIMELIB_PROCESS_YEAR(s->time->y, length);
1414 s->time->m = timelib_get_month((char **) &ptr);
1415 s->time->d = timelib_get_nr((char **) &ptr, 2);
1416 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1417 TIMELIB_PROCESS_YEAR(s->time->y, length);
1427 s->time->d = timelib_get_nr((char **) &ptr, 2);
1429 s->time->m = timelib_get_month((char **) &ptr);
1439 s->time->y = timelib_get_nr((char **) &ptr, 4);
1440 s->time->m = timelib_get_nr((char **) &ptr, 2);
1441 s->time->d = timelib_get_nr((char **) &ptr, 2);
1453 s->time->y = timelib_get_nr((char **) &ptr, 4);
1454 s->time->m = timelib_get_nr((char **) &ptr, 2);
1455 s->time->d = timelib_get_nr((char **) &ptr, 2);
1456 s->time->h = timelib_get_nr((char **) &ptr, 2);
1457 s->time->i = timelib_get_nr((char **) &ptr, 2);
1458 s->time->s = timelib_get_nr((char **) &ptr, 2);
1460 s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
1462 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1478 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1479 s->time->d = timelib_get_nr((char **) &ptr, 3);
1480 s->time->m = 1;
1481 TIMELIB_PROCESS_YEAR(s->time->y, length);
1494 s->time->y = timelib_get_nr((char **) &ptr, 4);
1497 s->time->m = 1;
1498 s->time->d = 1;
1499 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1513 s->time->y = timelib_get_nr((char **) &ptr, 4);
1516 s->time->m = 1;
1517 s->time->d = 1;
1518 s->time->relative.d = timelib_daynr_from_weeknr(s->time->y, w, d);
1530 s->time->m = timelib_get_month((char **) &ptr);
1531 s->time->d = timelib_get_nr((char **) &ptr, 2);
1532 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1533 TIMELIB_PROCESS_YEAR(s->time->y, length);
1544 s->time->y = timelib_get_nr_ex((char **) &ptr, 4, &length);
1545 s->time->m = timelib_get_month((char **) &ptr);
1546 s->time->d = timelib_get_nr((char **) &ptr, 2);
1547 TIMELIB_PROCESS_YEAR(s->time->y, length);
1559 s->time->d = timelib_get_nr((char **) &ptr, 2);
1560 s->time->m = timelib_get_month((char **) &ptr);
1561 s->time->y = timelib_get_nr((char **) &ptr, 4);
1562 s->time->h = timelib_get_nr((char **) &ptr, 2);
1563 s->time->i = timelib_get_nr((char **) &ptr, 2);
1564 s->time->s = timelib_get_nr((char **) &ptr, 2);
1565 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1577 s->time->y = timelib_get_nr((char **) &ptr, 4);
1586 s->time->relative.y = 0 - s->time->relative.y;
1587 s->time->relative.m = 0 - s->time->relative.m;
1588 s->time->relative.d = 0 - s->time->relative.d;
1589 s->time->relative.h = 0 - s->time->relative.h;
1590 s->time->relative.i = 0 - s->time->relative.i;
1591 s->time->relative.s = 0 - s->time->relative.s;
1592 s->time->relative.weekday = 0 - s->time->relative.weekday;
1593 if (s->time->relative.weekday == 0) {
1594 s->time->relative.weekday = -7;
1596 …if (s->time->relative.have_special_relative && s->time->relative.special.type == TIMELIB_SPECIAL_W…
1597 s->time->relative.special.amount = 0 - s->time->relative.special.amount;
1612 s->time->relative.weekday = relunit->multiplier;
1613 if (s->time->relative.weekday_behavior != 2) {
1614 s->time->relative.weekday_behavior = 1;
1633 s->time->relative.weekday_behavior = 2;
1636 if (s->time->relative.have_weekday_relative == 0) {
1638 s->time->relative.weekday = 1;
1667 s->time->m = timelib_lookup_month((char **) &ptr);
1678 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1691 s->time->m = timelib_get_month((char **) &ptr);
1692 s->time->d = timelib_get_nr((char **) &ptr, 2);
1695 s->time->h = timelib_get_nr((char **) &ptr, 2);
1696 s->time->i = timelib_get_nr((char **) &ptr, 2);
1698 s->time->s = timelib_get_nr((char **) &ptr, 2);
1701 s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
1705 s->time->h += timelib_meridian((char **) &ptr, s->time->h);
1716 s->time->m = timelib_get_month((char **) &ptr);
1717 s->time->d = timelib_get_nr((char **) &ptr, 2);
1720 s->time->h = timelib_get_nr((char **) &ptr, 2);
1721 s->time->i = timelib_get_nr((char **) &ptr, 2);
1723 s->time->s = timelib_get_nr((char **) &ptr, 2);
1726 s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
1731 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
1799 in.time = timelib_time_ctor();
1806 …in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->f = in.time…
1807 in.time->is_localtime = in.time->zone_type = 0;
1808 return in.time;
1817 in.time = timelib_time_ctor();
1818 in.time->y = TIMELIB_UNSET;
1819 in.time->d = TIMELIB_UNSET;
1820 in.time->m = TIMELIB_UNSET;
1821 in.time->h = TIMELIB_UNSET;
1822 in.time->i = TIMELIB_UNSET;
1823 in.time->s = TIMELIB_UNSET;
1824 in.time->f = TIMELIB_UNSET;
1825 in.time->z = TIMELIB_UNSET;
1826 in.time->dst = TIMELIB_UNSET;
1828 in.time->is_localtime = 0;
1829 in.time->zone_type = 0;
1830 in.time->relative.days = TIMELIB_UNSET;
1839 /* do funky checking whether the parsed time was valid time */
1840 if (in.time->have_time && !timelib_valid_time( in.time->h, in.time->i, in.time->s)) {
1841 add_warning(&in, "The parsed time was invalid");
1844 if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) {
1854 return in.time;
1868 static void timelib_time_reset_fields(timelib_time *time)
1870 assert(time != NULL);
1872 time->y = 1970;
1873 time->m = 1;
1874 time->d = 1;
1875 time->h = time->i = time->s = 0;
1876 time->f = 0.0;
1877 time->tz_info = NULL;
1880 static void timelib_time_reset_unset_fields(timelib_time *time)
1882 assert(time != NULL);
1884 if (time->y == TIMELIB_UNSET ) time->y = 1970;
1885 if (time->m == TIMELIB_UNSET ) time->m = 1;
1886 if (time->d == TIMELIB_UNSET ) time->d = 1;
1887 if (time->h == TIMELIB_UNSET ) time->h = 0;
1888 if (time->i == TIMELIB_UNSET ) time->i = 0;
1889 if (time->s == TIMELIB_UNSET ) time->s = 0;
1890 if (time->f == TIMELIB_UNSET ) time->f = 0.0;
1910 in.time = timelib_time_ctor();
1911 in.time->y = TIMELIB_UNSET;
1912 in.time->d = TIMELIB_UNSET;
1913 in.time->m = TIMELIB_UNSET;
1914 in.time->h = TIMELIB_UNSET;
1915 in.time->i = TIMELIB_UNSET;
1916 in.time->s = TIMELIB_UNSET;
1917 in.time->f = TIMELIB_UNSET;
1918 in.time->z = TIMELIB_UNSET;
1919 in.time->dst = TIMELIB_UNSET;
1921 in.time->is_localtime = 0;
1922 in.time->zone_type = 0;
1938 in.time->have_relative = 1;
1939 in.time->relative.have_weekday_relative = 1;
1940 in.time->relative.weekday = tmprel->multiplier;
1941 in.time->relative.weekday_behavior = 1;
1948 if ((s->time->d = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
1960 s->time->m = 1;
1961 s->time->d = tmp + 1;
1962 timelib_do_normalize(s->time);
1969 if ((s->time->m = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
1979 s->time->m = tmp;
1986 if ((s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length)) == TIMELIB_UNSET) {
1989 TIMELIB_PROCESS_YEAR(s->time->y, length);
1994 if ((s->time->y = timelib_get_nr((char **) &ptr, 4)) == TIMELIB_UNSET) {
2001 if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
2004 if (s->time->h > 12) {
2011 if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
2017 if (s->time->h == TIMELIB_UNSET) {
2019 } else if ((tmp = timelib_meridian_with_check((char **) &ptr, s->time->h)) == TIMELIB_UNSET) {
2022 s->time->h += tmp;
2035 s->time->i = min;
2049 s->time->s = sec;
2063 s->time->f = (f / pow(10, (ptr - tptr)));
2074 s->time->y = 1970;
2075 s->time->m = 1;
2076 s->time->d = 1;
2077 s->time->h = s->time->i = s->time->s = 0;
2078 s->time->relative.s += tmp;
2079 s->time->is_localtime = 1;
2080 s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
2081 s->time->z = 0;
2082 s->time->dst = 0;
2091 …s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz…
2122 timelib_time_reset_fields(s->time);
2126 timelib_time_reset_unset_fields(s->time);
2179 timelib_time_reset_fields(s->time);
2183 timelib_time_reset_unset_fields(s->time);
2194 if (s->time->h != TIMELIB_UNSET || s->time->i != TIMELIB_UNSET || s->time->s != TIMELIB_UNSET) {
2195 if (s->time->h == TIMELIB_UNSET ) {
2196 s->time->h = 0;
2198 if (s->time->i == TIMELIB_UNSET ) {
2199 s->time->i = 0;
2201 if (s->time->s == TIMELIB_UNSET ) {
2202 s->time->s = 0;
2206 /* do funky checking whether the parsed time was valid time */
2207 if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
2208 s->time->s != TIMELIB_UNSET &&
2209 !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
2210 add_pbf_warning(s, "The parsed time was invalid", string, ptr);
2213 if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
2214 s->time->d != TIMELIB_UNSET &&
2215 !timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
2224 return in.time;
2289 timelib_time time = timelib_strtotime("May 12");
2292 time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst);
2293 if (time.have_relative) {
2295 …time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative…
2297 if (time.have_weekday_relative) {
2298 printf (" / %d", time.relative.weekday);
2300 if (time.have_weeknr_day) {
2301 printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek);