]> Cypherpunks repositories - keks.git/commitdiff
Use raw format is year is not in four numbers
authorSergey Matveev <stargrave@stargrave.org>
Mon, 14 Apr 2025 06:34:53 +0000 (09:34 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 14 Apr 2025 06:34:53 +0000 (09:34 +0300)
go/cmd/pp/tcl.go

index 1c6e6220589c08bfe9184055df9437078b2ad740b01f6e76e6104070ef3d995e..b739d2c3517db29255bf9386d070f93ce8cb68f5bda963c55c1c1d70833e4e41 100644 (file)
@@ -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",