english text parser, as invalid times are never allowed in there.
return day + ((w - 1) * 7) + d;
}
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
+{
+ if (h < 0 || h > 23 || i < 0 || i > 59 || s < 0 || s > 59) {
+ return 0;
+ }
+ return 1;
+}
+
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d)
{
if (m < 1 || m > 12 || d < 1 || d > timelib_days_in_month(y, m)) {
-/* Generated by re2c 0.13.5 on Mon Jul 14 19:34:39 2008 */
+/* Generated by re2c 0.13.5 on Tue Jul 15 19:21:36 2008 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
}
}
+ /* do funky checking whether the parsed time was valid time */
+ if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
+ s->time->s != TIMELIB_UNSET &&
+ !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
+ add_pbf_warning(s, "The parsed time was invalid", string, ptr);
+ }
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
}
}
+ /* do funky checking whether the parsed time was valid time */
+ if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
+ s->time->s != TIMELIB_UNSET &&
+ !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
+ add_pbf_warning(s, "The parsed time was invalid", string, ptr);
+ }
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d);
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
/* From parse_date.re */