aboutsummaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2022-08-24 14:25:11 +0200
committerGopher Robot <gobot@golang.org>2022-08-29 20:05:34 +0000
commit9da49a7d2e47919ecbf54e75bfc15ffb022cf1d6 (patch)
tree08acc52c19879de9265ed5c20cdcef53d53eb90e /src/time
parentdbd0ce84d7c1da2e788c516c72fef44d5b760337 (diff)
downloadgo-9da49a7d2e47919ecbf54e75bfc15ffb022cf1d6.tar.xz
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>
Diffstat (limited to 'src/time')
-rw-r--r--src/time/zoneinfo_js.go26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/time/zoneinfo_js.go b/src/time/zoneinfo_js.go
index 06306cfd54..8da34a21fb 100644
--- a/src/time/zoneinfo_js.go
+++ b/src/time/zoneinfo_js.go
@@ -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"