pdns-auth-proxy/vendor/gopkg.in/djherbis/times.v1
Xavier Henner 97379c8e8a Initial euclide.org release 2023-11-17 06:55:06 +01:00
..
.travis.sh Initial euclide.org release 2023-11-17 06:55:06 +01:00
.travis.yml Initial euclide.org release 2023-11-17 06:55:06 +01:00
LICENSE Initial euclide.org release 2023-11-17 06:55:06 +01:00
README.md Initial euclide.org release 2023-11-17 06:55:06 +01:00
ctime_windows.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
js.cover.dockerfile Initial euclide.org release 2023-11-17 06:55:06 +01:00
js.cover.sh Initial euclide.org release 2023-11-17 06:55:06 +01:00
times.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_aix.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_darwin.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_dragonfly.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_freebsd.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_js.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_linux.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_nacl.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_netbsd.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_openbsd.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_plan9.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_solaris.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
times_windows.go Initial euclide.org release 2023-11-17 06:55:06 +01:00
use_generic_stat.go Initial euclide.org release 2023-11-17 06:55:06 +01:00

README.md

times

GoDoc Release Software License Build Status Coverage Status Go Report Card Sourcegraph

Usage

File Times for #golang

Go has a hidden time functions for most platforms, this repo makes them accessible.

package main

import (
  "log"

  "gopkg.in/djherbis/times.v1"
)

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())
  }
}

Supported Times

windows linux solaris dragonfly nacl freebsd darwin netbsd openbsd plan9 js aix
atime
mtime
ctime ✓*
btime
  • Windows XP does not have ChangeTime so HasChangeTime = false, however Vista onward does have ChangeTime so Timespec.HasChangeTime() will only return false on those platforms when the syscall used to obtain them fails.
  • Also note, Get(FileInfo) will now only return values available in FileInfo.Sys(), this means Stat() is required to get ChangeTime on Windows

Installation

go get gopkg.in/djherbis/times.v1