]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
util_time: Follow up to r1908380: Avoid apr_snprintf() like others.
authorYann Ylavic <ylavic@apache.org>
Tue, 14 Mar 2023 15:41:42 +0000 (15:41 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 14 Mar 2023 15:41:42 +0000 (15:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908389 13f79535-47bb-0310-9956-ffa450edef68

server/util_time.c

index 8fa7b19859f0c2f50b3767f7ea1bbfdb2c118472..033d05ef6cdc78a76a4ab54cb0651816ed806281 100644 (file)
@@ -262,18 +262,22 @@ AP_DECLARE(apr_status_t) ap_recent_ctime_ex(char *date_str, apr_time_t t,
         *date_str++ = real_year % 10 + '0';
     }
     if (option & AP_CTIME_OPTION_GMTOFF) {
-        int off = xt.tm_gmtoff;
+        int off = xt.tm_gmtoff, off_hh, off_mm;
         char sign = '+';
         if (off < 0) {
             off = -off;
             sign = '-';
         }
-        apr_snprintf(date_str, AP_CTIME_GMTOFF_LEN + 1, " %c%.2d%.2d",
-                     sign, off / 3600, (off % 3600) / 60);
-    }
-    else {
-        *date_str = 0;
+        off_hh = off / 3600;
+        off_mm = off % 3600 / 60;
+        *date_str++ = ' ';
+        *date_str++ = sign;
+        *date_str++ = off_hh / 10 + '0';
+        *date_str++ = off_hh % 10 + '0';
+        *date_str++ = off_mm / 10 + '0';
+        *date_str++ = off_mm % 10 + '0';
     }
+    *date_str = 0;
 
     return APR_SUCCESS;
 }