diff options
author | Yann Ylavic <ylavic@apache.org> | 2023-03-14 16:41:42 +0100 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2023-03-14 16:41:42 +0100 |
commit | 4be3a3b630475dedf35832d49c3cdc5d37615f2e (patch) | |
tree | 2b6c44bb9e5f62db8c7a8460a17fed1227ab42c5 /server | |
parent | core: Use the main ErrorLogFormat for ap_log_perror() and while loading vhosts. (diff) | |
download | apache2-4be3a3b630475dedf35832d49c3cdc5d37615f2e.tar.xz apache2-4be3a3b630475dedf35832d49c3cdc5d37615f2e.zip |
util_time: Follow up to r1908380: Avoid apr_snprintf() like others.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908389 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r-- | server/util_time.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/server/util_time.c b/server/util_time.c index 8fa7b19859..033d05ef6c 100644 --- a/server/util_time.c +++ b/server/util_time.c @@ -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; } |