• Martin Möhrmann's avatar
    time: unify formatting of decimals for timestamps · d5ef6981
    Martin Möhrmann authored
    Change function appendUint to appendInt with variable-width 0-padding.
    
    This allows the decimal for the year to be generated without extra code
    to handle the wider padding and directly handles negative numbers.
    
    Removes the special casing for numbers with one and two digits.
    The special case for 0 was unreachable.
    
    The new version is slightly slower.
    
    benchmark              old ns/op     new ns/op     delta
    BenchmarkFormat        444           454           +2.25%
    BenchmarkFormatNow     398           415           +4.27%
    
    Change-Id: I4ddef96bf07ad35dca76053321d510441ec6d4f5
    Reviewed-on: https://go-review.googlesource.com/2751Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    d5ef6981
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...