rclone/vendor/github.com/djherbis/times
2018-08-28 16:08:48 +01:00
..
.travis.yml vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
ctime_windows.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
LICENSE vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
README.md vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_darwin.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_dragonfly.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_freebsd.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_linux.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_nacl.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_netbsd.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_openbsd.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_plan9.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_solaris.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times_windows.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
times.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00
use_generic_stat.go vendor: vfs add vendor/github.com/djherbis/times 2017-11-20 12:36:50 +00:00

times

GoDoc
Release
Software License
Build Status
Coverage Status
Go Report Card

Usage

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

Supported Times

windows linux solaris dragonfly nacl freebsd darwin netbsd openbsd plan9
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 github.com/djherbis/times