mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Append subsec part instead of creating new string
This commit is contained in:
parent
160511d851
commit
ee35a4dad3
1 changed files with 1 additions and 1 deletions
2
time.c
2
time.c
|
@ -4145,7 +4145,7 @@ time_inspect(VALUE time)
|
||||||
}
|
}
|
||||||
else if (FIXNUM_P(subsec) && FIX2LONG(subsec) < TIME_SCALE) {
|
else if (FIXNUM_P(subsec) && FIX2LONG(subsec) < TIME_SCALE) {
|
||||||
long len;
|
long len;
|
||||||
str = rb_enc_sprintf(rb_usascii_encoding(), "%"PRIsVALUE".%09ld", str, FIX2LONG(subsec));
|
rb_str_catf(str, ".%09ld", FIX2LONG(subsec));
|
||||||
for (len=RSTRING_LEN(str); RSTRING_PTR(str)[len-1] == '0' && len > 0; len--)
|
for (len=RSTRING_LEN(str); RSTRING_PTR(str)[len-1] == '0' && len > 0; len--)
|
||||||
;
|
;
|
||||||
rb_str_resize(str, len);
|
rb_str_resize(str, len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue