mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
accounts/keystore: include minutes in toISO8601 timezone offset
The timezone suffix only encoded hours, producing incorrect filenames in zones with non-zero minute offsets (e.g. UTC+05:30 → "+0530" not "+00500"). Format both hours and minutes separately.
This commit is contained in:
parent
e3b6d0c86f
commit
faf48da321
1 changed files with 6 additions and 1 deletions
|
|
@ -230,7 +230,12 @@ func toISO8601(t time.Time) string {
|
|||
if name == "UTC" {
|
||||
tz = "Z"
|
||||
} else {
|
||||
tz = fmt.Sprintf("%+03d00", offset/3600)
|
||||
hours := offset / 3600
|
||||
minutes := (offset % 3600) / 60
|
||||
if minutes < 0 {
|
||||
minutes = -minutes
|
||||
}
|
||||
tz = fmt.Sprintf("%+03d%02d", hours, minutes)
|
||||
}
|
||||
return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s",
|
||||
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz)
|
||||
|
|
|
|||
Loading…
Reference in a new issue