You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/10/18 13:15:45 UTC

svn commit: r1533387 - /subversion/trunk/subversion/libsvn_subr/time.c

Author: stefan2
Date: Fri Oct 18 11:15:45 2013
New Revision: 1533387

URL: http://svn.apache.org/r1533387
Log:
Minor speed-up to the str->time conversion function that is
used e.g. in our network layers.

* subversion/libsvn_subr/time.c
  (svn_time_from_cstring): use SVN's own, faster atol variant

Modified:
    subversion/trunk/subversion/libsvn_subr/time.c

Modified: subversion/trunk/subversion/libsvn_subr/time.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/time.c?rev=1533387&r1=1533386&r2=1533387&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/time.c (original)
+++ subversion/trunk/subversion/libsvn_subr/time.c Fri Oct 18 11:15:45 2013
@@ -34,6 +34,8 @@
 #include "svn_error.h"
 #include "svn_private_config.h"
 
+#include "private/svn_string_private.h"
+
 
 
 /*** Code. ***/
@@ -135,24 +137,24 @@ svn_time_from_cstring(apr_time_t *when, 
   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;