Skip to content

Instantly share code, notes, and snippets.

@knight76
Created October 11, 2019 10:53
Show Gist options
  • Save knight76/bbdb187fd0b6784fe810e1200f4ec2be to your computer and use it in GitHub Desktop.
Save knight76/bbdb187fd0b6784fe810e1200f4ec2be to your computer and use it in GitHub Desktop.
ts2dt
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