From 840758b3a9e33e18ed5df54ad4431fea1f06b2de4466c44d8c5adc331166a51a Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 14 Apr 2025 09:34:53 +0300 Subject: [PATCH] Use raw format is year is not in four numbers --- go/cmd/pp/tcl.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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", -- 2.48.1