• 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
..
example_test.go Loading commit data...
export_test.go Loading commit data...
export_windows_test.go Loading commit data...
format.go Loading commit data...
format_test.go Loading commit data...
genzabbrs.go Loading commit data...
internal_test.go Loading commit data...
sleep.go Loading commit data...
sleep_test.go Loading commit data...
sys_plan9.go Loading commit data...
sys_unix.go Loading commit data...
sys_windows.go Loading commit data...
tick.go Loading commit data...
tick_test.go Loading commit data...
time.go Loading commit data...
time_test.go Loading commit data...
zoneinfo.go Loading commit data...
zoneinfo_abbrs_windows.go Loading commit data...
zoneinfo_ios.go Loading commit data...
zoneinfo_plan9.go Loading commit data...
zoneinfo_read.go Loading commit data...
zoneinfo_test.go Loading commit data...
zoneinfo_unix.go Loading commit data...
zoneinfo_windows.go Loading commit data...
zoneinfo_windows_test.go Loading commit data...