File Times for #golang
Go has a hidden time functions for most platforms, this repo makes them accessible.
package main
import (
"log"
"github.com/djherbis/times"
)
func main() {
t, err := times.Stat("myfile")
if err != nil {
log.Fatal(err.Error())
}
log.Println(t.AccessTime())
log.Println(t.ModTime())
if t.HasChangeTime() {
log.Println(t.ChangeTime())
}
if t.HasBirthTime() {
log.Println(t.BirthTime())
}
}
| windows | linux | solaris | dragonfly | nacl | freebsd | darwin | netbsd | openbsd | plan9 | js | aix | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| atime | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mtime | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| ctime | ✓* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| btime | ✓ | ✓* | ✓ | ✓ | ✓ |
go get -u github.com/djherbis/times
190 followers · starred Oct 2023
29 followers · starred Jan 2025
126 followers · starred Dec 2024
110 followers · starred Jul 2024
File Times for #golang
Go has a hidden time functions for most platforms, this repo makes them accessible.
package main
import (
"log"
"github.com/djherbis/times"
)
func main() {
t, err := times.Stat("myfile")
if err != nil {
log.Fatal(err.Error())
}
log.Println(t.AccessTime())
log.Println(t.ModTime())
if t.HasChangeTime() {
log.Println(t.ChangeTime())
}
if t.HasBirthTime() {
log.Println(t.BirthTime())
}
}
| windows | linux | solaris | dragonfly | nacl | freebsd | darwin | netbsd | openbsd | plan9 | js | aix | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| atime | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mtime | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| ctime | ✓* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| btime | ✓ | ✓* | ✓ | ✓ | ✓ |
go get -u github.com/djherbis/times
190 followers · starred Oct 2023
29 followers · starred Jan 2025
126 followers · starred Dec 2024
110 followers · starred Jul 2024