aboutsummaryrefslogtreecommitdiffstats
path: root/strftime.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-29 09:47:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-29 09:47:42 +0000
commit90b361a6ff9c139e91ba34750593db9d79ecdd8a (patch)
tree872b5f315f44aee9bf8835b934b42b15057c52cc /strftime.c
parent720e9aa08f7ce6b149e87949778cb345fa9522d9 (diff)
downloadruby-90b361a6ff9c139e91ba34750593db9d79ecdd8a.tar.gz
vsnprintf.c: prefix with precision
* vsnprintf.c (BSD_vfprintf): sign and hex-prefix should not be counted in precision. [ruby-dev:47714] [Bug #8916] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r--strftime.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/strftime.c b/strftime.c
index dbb593ae1e..025be94afb 100644
--- a/strftime.c
+++ b/strftime.c
@@ -582,7 +582,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
goto unknown;
}
i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"),
- precision + 1, sign * (off / 3600));
+ precision + (padding == ' '), sign * (off / 3600));
if (i < 0) goto err;
if (sign < 0 && off < 3600) {
*(padding == ' ' ? s + i - 2 : s) = '-';