diff options
author | Hans Bolinder <[email protected]> | 2018-12-03 08:24:26 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2018-12-03 08:24:26 +0100 |
commit | 2eeab3cc011ec503d7831fe588557f60d69aa8be (patch) | |
tree | a2d29d481e67fe06473e05a0fa23a042eb5c6a2c /lib/stdlib/src | |
parent | 8756194c4c33d724d00aaa706175693575c9990d (diff) | |
parent | 8ec20295ba052e5666fc77b66c09445233943814 (diff) | |
download | otp-2eeab3cc011ec503d7831fe588557f60d69aa8be.tar.gz otp-2eeab3cc011ec503d7831fe588557f60d69aa8be.tar.bz2 otp-2eeab3cc011ec503d7831fe588557f60d69aa8be.zip |
Merge pull request #2036 from uabboli/hasse/stdlib/rfc3339_fraction/OTP-15464
stdlib: Let calendar:system_time_to_rfc3339() keep fractions
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/calendar.erl | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/stdlib/src/calendar.erl b/lib/stdlib/src/calendar.erl index 9a600c1972..bb5d450cd6 100644 --- a/lib/stdlib/src/calendar.erl +++ b/lib/stdlib/src/calendar.erl @@ -693,14 +693,11 @@ local_offset(SystemTime, Unit) -> UniversalSecs = datetime_to_gregorian_seconds(UniversalTime), LocalSecs - UniversalSecs. +fraction_str(1, _Time) -> + ""; fraction_str(Factor, Time) -> - case Time rem Factor of - 0 -> - ""; - Fraction -> - FS = io_lib:fwrite(".~*..0B", [log10(Factor), abs(Fraction)]), - string:trim(FS, trailing, "0") - end. + Fraction = Time rem Factor, + io_lib:fwrite(".~*..0B", [log10(Factor), abs(Fraction)]). fraction(second, _) -> 0; |