82
84
/* Machine parseable part, generated by apr_snprintf. */
83
85
#define HUMAN_TIMESTAMP_FORMAT "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %+.2d%.2d"
84
86
/* Human explanatory part, generated by apr_strftime as "Sat, 01 Jan 2000" */
85
#define human_timestamp_format_suffix _(" (%a, %d %b %Y)")
87
#define HUMAN_TIMESTAMP_FORMAT_SUFFIX _(" (%a, %d %b %Y)")
88
90
svn_time_to_cstring(apr_time_t when, apr_pool_t *pool)
135
137
apr_time_exp_t exploded_time;
136
138
apr_status_t apr_err;
137
139
char wday[4], month[4];
140
142
/* Open-code parsing of the new timestamp format, as this
141
143
is a hot path for reading the entries file. This format looks
142
144
like: "2001-08-31T04:24:14.966996Z" */
143
exploded_time.tm_year = (apr_int32_t) strtol(data, &c, 10);
144
if (*c++ != '-') goto fail;
145
exploded_time.tm_mon = (apr_int32_t) strtol(c, &c, 10);
146
if (*c++ != '-') goto fail;
147
exploded_time.tm_mday = (apr_int32_t) strtol(c, &c, 10);
145
exploded_time.tm_year = (apr_int32_t) svn__strtoul(data, &c);
146
if (*c++ != '-') goto fail;
147
exploded_time.tm_mon = (apr_int32_t) svn__strtoul(c, &c);
148
if (*c++ != '-') goto fail;
149
exploded_time.tm_mday = (apr_int32_t) svn__strtoul(c, &c);
148
150
if (*c++ != 'T') goto fail;
149
exploded_time.tm_hour = (apr_int32_t) strtol(c, &c, 10);
150
if (*c++ != ':') goto fail;
151
exploded_time.tm_min = (apr_int32_t) strtol(c, &c, 10);
152
if (*c++ != ':') goto fail;
153
exploded_time.tm_sec = (apr_int32_t) strtol(c, &c, 10);
151
exploded_time.tm_hour = (apr_int32_t) svn__strtoul(c, &c);
152
if (*c++ != ':') goto fail;
153
exploded_time.tm_min = (apr_int32_t) svn__strtoul(c, &c);
154
if (*c++ != ':') goto fail;
155
exploded_time.tm_sec = (apr_int32_t) svn__strtoul(c, &c);
154
156
if (*c++ != '.') goto fail;
155
exploded_time.tm_usec = (apr_int32_t) strtol(c, &c, 10);
157
exploded_time.tm_usec = (apr_int32_t) svn__strtoul(c, &c);
156
158
if (*c++ != 'Z') goto fail;
158
160
exploded_time.tm_year -= 1900;
245
247
ret = apr_strftime(human_datestr,
247
249
SVN_TIME__MAX_LENGTH - len,
248
human_timestamp_format_suffix,
250
HUMAN_TIMESTAMP_FORMAT_SUFFIX,
251
253
/* If there was an error, ensure that the string is zero-terminated. */