From: Sergey Matveev Date: Mon, 14 Apr 2025 06:34:53 +0000 (+0300) Subject: Use raw format is year is not in four numbers X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=840758b3a9e33e18ed5df54ad4431fea1f06b2de4466c44d8c5adc331166a51a;p=keks.git Use raw format is year is not in four numbers --- diff --git a/go/cmd/pp/tcl.go b/go/cmd/pp/tcl.go index 1c6e622..b739d2c 100644 --- a/go/cmd/pp/tcl.go +++ b/go/cmd/pp/tcl.go @@ -31,7 +31,11 @@ import ( func tclTAI(t time.Time, ns int, as uint64) { utc, isLeap := tai64n.Leapsecs.Sub(t) - if isLeap || utc.Unix() < 0 { + year := utc.Year() + if year < 0 { + year = -year + } + if isLeap || year > 9999 { fmt.Printf("TAI64 %d %d %d", t.Unix(), ns, as) } else { fmt.Printf("TAI64 [UTCFromISO \"%s\"] %d %d",