Documentation ¶
Overview ¶
TAI64/TAI64N (http://cr.yp.to/libtai/tai64.html) dealing library. You can convert time to TAI64/TAI64N and vice versa with it.
tai := new(tai64n.TAI64N) tai.FromTime(time.Now()) printable := tai64n.Encode(tai[:]) decoded, err := tai64n.Decode(printable) tai64n.ToTime(tai[:]) == decoded
By default TAI64 timestamps contain initial 1972-01-01 10-seconds TAI<->UTC difference. If you need honest TAI representation, then you should also use Leapsecs* functions.
Index ¶
- Constants
- Variables
- func Decode(s string) (time.Time, error)
- func Encode(tai []byte) string
- func LeapsecsAdd(t time.Time) time.Time
- func LeapsecsDBLoad(buf []byte)
- func LeapsecsDiff(t int64) int
- func LeapsecsSub(t time.Time) time.Time
- func ToTime(tai []byte) time.Time
- type Int64s
- type TAI64
- type TAI64N
Constants ¶
const ( TAI64Size = 8 TAI64NSize = TAI64Size + 4 LocalFmt = "2006-01-02 15:04:05.000000000" Base = 0x4000000000000000 + Leapsecs1972 )
const Leapsecs1972 = 10
Variables ¶
var LeapsecsDB []int64
Database of Unix timestamps of the time when leap second occurred. Library contains and initializes it with leap seconds up to 2016-12-31.
Functions ¶
func LeapsecsAdd ¶
Add currently known (LeapsecsDB) leap seconds, not including initial 1972-01-01 10-seconds offset.
func LeapsecsDBLoad ¶
func LeapsecsDBLoad(buf []byte)
Load "leapsecs.dat"-like database: concatenated TAI64 leap seconds. Function panics if encoding is invalid.
func LeapsecsDiff ¶
TAI<->UTC difference for the given Unix timestamp.