Append subsec part instead of creating new string
This commit is contained in:
parent
160511d851
commit
ee35a4dad3
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…
x
Reference in New Issue
Block a user