mirror of https://github.com/golang/go.git
time: use internal/itoa
In initLocal for GOOS=js, use internal/itoa introduced in CL 301549 instead of a local implementation. Change-Id: If107d5cf0ce56f4d926507db2cbd6da422c6d15a Reviewed-on: https://go-review.googlesource.com/c/go/+/425302 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
dbd0ce84d7
commit
9da49a7d2e
|
|
@ -7,6 +7,7 @@
|
|||
package time
|
||||
|
||||
import (
|
||||
"internal/itoa"
|
||||
"syscall/js"
|
||||
)
|
||||
|
||||
|
|
@ -35,31 +36,10 @@ func initLocal() {
|
|||
} else {
|
||||
z.name += "+"
|
||||
}
|
||||
z.name += itoa(offset / 60)
|
||||
z.name += itoa.Itoa(offset / 60)
|
||||
min := offset % 60
|
||||
if min != 0 {
|
||||
z.name += ":" + itoa(min)
|
||||
z.name += ":" + itoa.Itoa(min)
|
||||
}
|
||||
localLoc.zone = []zone{z}
|
||||
}
|
||||
|
||||
// itoa is like strconv.Itoa but only works for values of i in range [0,99].
|
||||
// It panics if i is out of range.
|
||||
func itoa(i int) string {
|
||||
if i < 10 {
|
||||
return digits[i : i+1]
|
||||
}
|
||||
return smallsString[i*2 : i*2+2]
|
||||
}
|
||||
|
||||
const smallsString = "00010203040506070809" +
|
||||
"10111213141516171819" +
|
||||
"20212223242526272829" +
|
||||
"30313233343536373839" +
|
||||
"40414243444546474849" +
|
||||
"50515253545556575859" +
|
||||
"60616263646566676869" +
|
||||
"70717273747576777879" +
|
||||
"80818283848586878889" +
|
||||
"90919293949596979899"
|
||||
const digits = "0123456789"
|
||||
|
|
|
|||
Loading…
Reference in New Issue