Skip to content

Instantly share code, notes, and snippets.

@williamlsh
Created February 19, 2019 10:23
Show Gist options
  • Save williamlsh/c45cc897c58c226a7c8413a63380ea4a to your computer and use it in GitHub Desktop.
Save williamlsh/c45cc897c58c226a7c8413a63380ea4a to your computer and use it in GitHub Desktop.
func birthTime(){
sampleFile := "testdata/sample.md"
fi, err := os.Stat(sampleFile)
if err != nil {
return
}
// fmt.Printf("file info: %v", fi.ModTime())
stat := fi.Sys().(*syscall.Stat_t)
birthTime := time.Unix(stat.Birthtimespec.Unix()).Unix()
fmt.Println(birthTime)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment