From: Sergey Matveev Date: Mon, 7 Apr 2025 07:51:11 +0000 (+0300) Subject: Fixed mistakenly leading docstring X-Git-Tag: v4.1.1^0 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;p=gotai64n.git Fixed mistakenly leading docstring --- diff --git a/leapsecs.go b/leapsecs.go index dc76829..a480f0e 100644 --- a/leapsecs.go +++ b/leapsecs.go @@ -27,9 +27,9 @@ type LeapsecsList []int64 // Library contains and initializes it with leap seconds up to 2016-12-31. var Leapsecs LeapsecsList -// Add leap seconds to the time (convert TAI to UTC). -func (leapsecs LeapsecsList) Add(tai time.Time) (utc time.Time) { - orig := tai.Unix() +// Add leap seconds to the time (convert UTC to TAI). +func (leapsecs LeapsecsList) Add(utc time.Time) (tai time.Time) { + orig := utc.Unix() v := orig v += Leapsecs1972 for _, leapsec := range Leapsecs { @@ -37,14 +37,14 @@ func (leapsecs LeapsecsList) Add(tai time.Time) (utc time.Time) { v++ } } - utc = tai.Add(time.Second * time.Duration(v-orig)) + tai = utc.Add(time.Second * time.Duration(v-orig)) return } -// Subtract leap seconds from the time (convert UTC to TAI). -func (leapsecs LeapsecsList) Sub(utc time.Time) (tai time.Time, isLeap bool) { +// Subtract leap seconds from the time (convert TAI to UTC). +func (leapsecs LeapsecsList) Sub(tai time.Time) (utc time.Time, isLeap bool) { diff := int64(Leapsecs1972) - v := utc.Unix() + v := tai.Unix() for _, leapsec := range leapsecs { if v < leapsec { break @@ -55,7 +55,7 @@ func (leapsecs LeapsecsList) Sub(utc time.Time) (tai time.Time, isLeap bool) { break } } - tai = utc.Add(-time.Second * time.Duration(diff)) + utc = tai.Add(-time.Second * time.Duration(diff)) return }