65
{ 'Y', DIGITS, ACCUM, APR_OFFSETOF (match_state, base.tm_year) },
66
{ 'M', DIGITS, ACCUM, APR_OFFSETOF (match_state, base.tm_mon) },
67
{ 'D', DIGITS, ACCUM, APR_OFFSETOF (match_state, base.tm_mday) },
68
{ 'h', DIGITS, ACCUM, APR_OFFSETOF (match_state, base.tm_hour) },
69
{ 'm', DIGITS, ACCUM, APR_OFFSETOF (match_state, base.tm_min) },
70
{ 's', DIGITS, ACCUM, APR_OFFSETOF (match_state, base.tm_sec) },
71
{ 'u', DIGITS, MICRO, APR_OFFSETOF (match_state, base.tm_usec) },
72
{ 'O', DIGITS, ACCUM, APR_OFFSETOF (match_state, offhours) },
73
{ 'o', DIGITS, ACCUM, APR_OFFSETOF (match_state, offminutes) },
65
{ 'Y', DIGITS, ACCUM, APR_OFFSETOF(match_state, base.tm_year) },
66
{ 'M', DIGITS, ACCUM, APR_OFFSETOF(match_state, base.tm_mon) },
67
{ 'D', DIGITS, ACCUM, APR_OFFSETOF(match_state, base.tm_mday) },
68
{ 'h', DIGITS, ACCUM, APR_OFFSETOF(match_state, base.tm_hour) },
69
{ 'm', DIGITS, ACCUM, APR_OFFSETOF(match_state, base.tm_min) },
70
{ 's', DIGITS, ACCUM, APR_OFFSETOF(match_state, base.tm_sec) },
71
{ 'u', DIGITS, MICRO, APR_OFFSETOF(match_state, base.tm_usec) },
72
{ 'O', DIGITS, ACCUM, APR_OFFSETOF(match_state, offhours) },
73
{ 'o', DIGITS, ACCUM, APR_OFFSETOF(match_state, offminutes) },
74
74
{ '+', "-+", TZIND, 0 },
75
75
{ 'Z', "Z", TZIND, 0 },
76
76
{ ':', ":", NOOP, 0 },
102
102
should be used to interpret the match (i.e. if no time zone
103
103
information was provided), or FALSE if not. */
104
104
static svn_boolean_t
105
template_match (apr_time_exp_t *expt, svn_boolean_t *localtz,
106
const char *template, const char *value)
105
template_match(apr_time_exp_t *expt, svn_boolean_t *localtz,
106
const char *template, const char *value)
108
108
int multiplier = 100000;
111
111
char *base = (char *)&ms;
113
memset (&ms, 0, sizeof (ms));
113
memset(&ms, 0, sizeof(ms));
117
const rule *match = find_rule (*template++);
117
const rule *match = find_rule(*template++);
118
118
char vchar = *value++;
119
119
apr_int32_t *place;
121
121
if (!match || (match->valid
122
&& (!vchar || !strchr (match->valid, vchar))))
122
&& (!vchar || !strchr(match->valid, vchar))))
125
125
/* Compute the address of memory location affected by this
200
200
*matched = FALSE;
202
apr_err = apr_time_exp_lt (&expnow, now);
202
apr_err = apr_time_exp_lt(&expnow, now);
203
203
if (apr_err != APR_SUCCESS)
204
return svn_error_wrap_apr (apr_err, _("Can't manipulate current date"));
204
return svn_error_wrap_apr(apr_err, _("Can't manipulate current date"));
206
if (template_match (&expt, &localtz, /* ISO-8601 extended, date only */
209
|| template_match (&expt, &localtz, /* ISO-8601 extended, UTC */
210
"YYYY-M[M]-D[D]Th[h]:mm[:ss[.u[u[u[u[u[u][Z]",
212
|| template_match (&expt, &localtz, /* ISO-8601 extended, with offset */
213
"YYYY-M[M]-D[D]Th[h]:mm[:ss[.u[u[u[u[u[u]+OO[:oo]",
215
|| template_match (&expt, &localtz, /* ISO-8601 basic, date only */
218
|| template_match (&expt, &localtz, /* ISO-8601 basic, UTC */
219
"YYYYMMDDThhmm[ss[.u[u[u[u[u[u][Z]",
221
|| template_match (&expt, &localtz, /* ISO-8601 basic, with offset */
222
"YYYYMMDDThhmm[ss[.u[u[u[u[u[u]+OO[oo]",
224
|| template_match (&expt, &localtz, /* "svn log" format */
225
"YYYY-M[M]-D[D] h[h]:mm[:ss[.u[u[u[u[u[u][ +OO[oo]",
227
|| template_match (&expt, &localtz, /* GNU date's iso-8601 */
228
"YYYY-M[M]-D[D]Th[h]:mm[:ss[.u[u[u[u[u[u]+OO[oo]",
206
if (template_match(&expt, &localtz, /* ISO-8601 extended, date only */
209
|| template_match(&expt, &localtz, /* ISO-8601 extended, UTC */
210
"YYYY-M[M]-D[D]Th[h]:mm[:ss[.u[u[u[u[u[u][Z]",
212
|| template_match(&expt, &localtz, /* ISO-8601 extended, with offset */
213
"YYYY-M[M]-D[D]Th[h]:mm[:ss[.u[u[u[u[u[u]+OO[:oo]",
215
|| template_match(&expt, &localtz, /* ISO-8601 basic, date only */
218
|| template_match(&expt, &localtz, /* ISO-8601 basic, UTC */
219
"YYYYMMDDThhmm[ss[.u[u[u[u[u[u][Z]",
221
|| template_match(&expt, &localtz, /* ISO-8601 basic, with offset */
222
"YYYYMMDDThhmm[ss[.u[u[u[u[u[u]+OO[oo]",
224
|| template_match(&expt, &localtz, /* "svn log" format */
225
"YYYY-M[M]-D[D] h[h]:mm[:ss[.u[u[u[u[u[u][ +OO[oo]",
227
|| template_match(&expt, &localtz, /* GNU date's iso-8601 */
228
"YYYY-M[M]-D[D]Th[h]:mm[:ss[.u[u[u[u[u[u]+OO[oo]",
231
231
expt.tm_year -= 1900;
232
232
expt.tm_mon -= 1;
234
else if (template_match (&expt, &localtz, /* Just a time */
235
"h[h]:mm[:ss[.u[u[u[u[u[u]",
234
else if (template_match(&expt, &localtz, /* Just a time */
235
"h[h]:mm[:ss[.u[u[u[u[u[u]",
238
238
expt.tm_year = expnow.tm_year;
239
239
expt.tm_mon = expnow.tm_mon;
272
272
not. So, calculate the time value using the current time's
273
273
GMT offset and use the GMT offset of the resulting time. */
274
274
expt.tm_gmtoff = expnow.tm_gmtoff;
275
apr_err = apr_time_exp_gmt_get (&candidate, &expt);
276
if (apr_err != APR_SUCCESS)
277
return svn_error_wrap_apr (apr_err,
278
_("Can't calculate requested date"));
279
apr_err = apr_time_exp_lt (&expthen, candidate);
280
if (apr_err != APR_SUCCESS)
281
return svn_error_wrap_apr (apr_err, _("Can't expand time"));
275
apr_err = apr_time_exp_gmt_get(&candidate, &expt);
276
if (apr_err != APR_SUCCESS)
277
return svn_error_wrap_apr(apr_err,
278
_("Can't calculate requested date"));
279
apr_err = apr_time_exp_lt(&expthen, candidate);
280
if (apr_err != APR_SUCCESS)
281
return svn_error_wrap_apr(apr_err, _("Can't expand time"));
282
282
expt.tm_gmtoff = expthen.tm_gmtoff;
284
apr_err = apr_time_exp_gmt_get (result, &expt);
284
apr_err = apr_time_exp_gmt_get(result, &expt);
285
285
if (apr_err != APR_SUCCESS)
286
return svn_error_wrap_apr (apr_err, _("Can't calculate requested date"));
286
return svn_error_wrap_apr(apr_err, _("Can't calculate requested date"));
289
289
return SVN_NO_ERROR;