Debian Codegraph @

README.md

raw symbols SCIP
1 tai64
2 =====
3
4 > [!IMPORTANT]
5 > Moved to [codeberg](https://codeberg.org/dropwhile/tai64)!
6
7 ## About
8
9 Formats and parses [TAI64 and TAI64N][1] timestamps.
10
11 ## Usage
12
13 ``` go
14 package main
15
16 import (
17 "fmt"
18 "os"
19 "time"
20
21 "github.com/cactus/tai64"
22 )
23
24 func main() {
25 t := time.Now()
26 fmt.Println(t)
27
28 s := tai64.FormatNano(t)
29 fmt.Println(s)
30
31 p, err := tai64.Parse(s)
32 if err != nil {
33 fmt.Println("Failed to decode time")
34 os.Exit(1)
35 }
36
37 // tai64 times are in UTC
38 fmt.Println(p)
39
40 // time.Equal properly compares times with different locations.
41 if t.Equal(p) {
42 fmt.Println("equal")
43 } else {
44 fmt.Println("not equal")
45 }
46 }
47 ```
48
49 Output:
50
51 ```
52 2016-05-25 13:44:01.281160355 -0700 PDT
53 @4000000057460eb510c22aa3
54 2016-05-25 20:44:01.281160355 +0000 UTC
55 equal
56 ```
57
58 ## License
59
60 Released under the [ISC license][2]. See `LICENSE.md` file for details.
61
62
63 [1]: https://cr.yp.to/libtai/tai64.html
64 [2]: https://choosealicense.com/licenses/isc/