Created
October 11, 2019 10:53
-
-
Save knight76/bbdb187fd0b6784fe810e1200f4ec2be to your computer and use it in GitHub Desktop.
ts2dt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"strconv" | |
"os" | |
) | |
func main() { | |
fmt.Println(len(os.Args)) | |
if len(os.Args) == 1 { | |
fmt.Println("----- usage") | |
fmt.Println("ts2dt 0") | |
fmt.Println("ts2dt 1570790541") | |
return | |
} | |
if len(os.Args) > 2 { | |
panic("error: only one timestmap") | |
} | |
ts := os.Args[1] | |
i, err := strconv.ParseInt(ts, 10, 64) | |
if err != nil { | |
panic(err) | |
} | |
tm := time.Unix(i, 0) | |
fmt.Println(tm) | |
} | |
// go build ts2dt.gio | |
// ./ts2dt 1570790541 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment