summaryrefslogtreecommitdiff
path: root/subversion/libsvn_subr/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_subr/time.c')
-rw-r--r--subversion/libsvn_subr/time.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/subversion/libsvn_subr/time.c b/subversion/libsvn_subr/time.c
index ccd6269..7fd6da0 100644
--- a/subversion/libsvn_subr/time.c
+++ b/subversion/libsvn_subr/time.c
@@ -34,6 +34,8 @@
#include "svn_error.h"
#include "svn_private_config.h"
+#include "private/svn_string_private.h"
+
/*** Code. ***/
@@ -82,7 +84,7 @@
/* Machine parseable part, generated by apr_snprintf. */
#define HUMAN_TIMESTAMP_FORMAT "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %+.2d%.2d"
/* Human explanatory part, generated by apr_strftime as "Sat, 01 Jan 2000" */
-#define human_timestamp_format_suffix _(" (%a, %d %b %Y)")
+#define HUMAN_TIMESTAMP_FORMAT_SUFFIX _(" (%a, %d %b %Y)")
const char *
svn_time_to_cstring(apr_time_t when, apr_pool_t *pool)
@@ -135,24 +137,24 @@ svn_time_from_cstring(apr_time_t *when, const char *data, apr_pool_t *pool)
apr_time_exp_t exploded_time;
apr_status_t apr_err;
char wday[4], month[4];
- char *c;
+ const char *c;
/* Open-code parsing of the new timestamp format, as this
is a hot path for reading the entries file. This format looks
like: "2001-08-31T04:24:14.966996Z" */
- exploded_time.tm_year = (apr_int32_t) strtol(data, &c, 10);
+ exploded_time.tm_year = (apr_int32_t) svn__strtoul(data, &c);
if (*c++ != '-') goto fail;
- exploded_time.tm_mon = (apr_int32_t) strtol(c, &c, 10);
+ exploded_time.tm_mon = (apr_int32_t) svn__strtoul(c, &c);
if (*c++ != '-') goto fail;
- exploded_time.tm_mday = (apr_int32_t) strtol(c, &c, 10);
+ exploded_time.tm_mday = (apr_int32_t) svn__strtoul(c, &c);
if (*c++ != 'T') goto fail;
- exploded_time.tm_hour = (apr_int32_t) strtol(c, &c, 10);
+ exploded_time.tm_hour = (apr_int32_t) svn__strtoul(c, &c);
if (*c++ != ':') goto fail;
- exploded_time.tm_min = (apr_int32_t) strtol(c, &c, 10);
+ exploded_time.tm_min = (apr_int32_t) svn__strtoul(c, &c);
if (*c++ != ':') goto fail;
- exploded_time.tm_sec = (apr_int32_t) strtol(c, &c, 10);
+ exploded_time.tm_sec = (apr_int32_t) svn__strtoul(c, &c);
if (*c++ != '.') goto fail;
- exploded_time.tm_usec = (apr_int32_t) strtol(c, &c, 10);
+ exploded_time.tm_usec = (apr_int32_t) svn__strtoul(c, &c);
if (*c++ != 'Z') goto fail;
exploded_time.tm_year -= 1900;
@@ -245,7 +247,7 @@ svn_time_to_human_cstring(apr_time_t when, apr_pool_t *pool)
ret = apr_strftime(human_datestr,
&retlen,
SVN_TIME__MAX_LENGTH - len,
- human_timestamp_format_suffix,
+ HUMAN_TIMESTAMP_FORMAT_SUFFIX,
&exploded_time);
/* If there was an error, ensure that the string is zero-terminated. */