Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
example/ | H | 31-Dec-2018 | - | 97 | 78 | |
.travis.sh | H A D | 31-Dec-2018 | 615 | 28 | 22 | |
.travis.yml | H A D | 31-Dec-2018 | 364 | 19 | 19 | |
LICENSE | H A D | 31-Dec-2018 | 1.1 KiB | 23 | 17 | |
README.md | H A D | 31-Dec-2018 | 2.3 KiB | 65 | 51 | |
bench_test.go | H A D | 31-Dec-2018 | 834 | 57 | 49 | |
ctime_windows.go | H A D | 31-Dec-2018 | 3.3 KiB | 150 | 118 | |
js.cover.dockerfile | H A D | 31-Dec-2018 | 286 | 9 | 6 | |
js.cover.sh | H A D | 31-Dec-2018 | 272 | 7 | 5 | |
times.go | H A D | 31-Dec-2018 | 1.5 KiB | 75 | 48 | |
times_darwin.go | H A D | 31-Dec-2018 | 836 | 41 | 27 | |
times_dragonfly.go | H A D | 31-Dec-2018 | 779 | 40 | 26 | |
times_freebsd.go | H A D | 31-Dec-2018 | 837 | 41 | 27 | |
times_js.go | H A D | 31-Dec-2018 | 823 | 42 | 26 | |
times_linux.go | H A D | 31-Dec-2018 | 775 | 40 | 26 | |
times_nacl.go | H A D | 31-Dec-2018 | 804 | 40 | 26 | |
times_netbsd.go | H A D | 31-Dec-2018 | 836 | 41 | 27 | |
times_openbsd.go | H A D | 31-Dec-2018 | 777 | 40 | 26 | |
times_plan9.go | H A D | 31-Dec-2018 | 643 | 35 | 22 | |
times_solaris.go | H A D | 31-Dec-2018 | 777 | 40 | 26 | |
times_test.go | H A D | 31-Dec-2018 | 2.3 KiB | 126 | 102 | |
times_windows.go | H A D | 31-Dec-2018 | 763 | 37 | 24 | |
times_windows_test.go | H A D | 31-Dec-2018 | 1.4 KiB | 76 | 64 | |
use_generic_stat.go | H A D | 31-Dec-2018 | 334 | 16 | 8 | |
util_test.go | H A D | 31-Dec-2018 | 1.8 KiB | 82 | 65 |
README.md
1times 2========== 3 4[![GoDoc](https://godoc.org/github.com/djherbis/times?status.svg)](https://godoc.org/github.com/djherbis/times) 5[![Release](https://img.shields.io/github/release/djherbis/times.svg)](https://github.com/djherbis/times/releases/latest) 6[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.txt) 7[![Build Status](https://travis-ci.org/djherbis/times.svg?branch=master)](https://travis-ci.org/djherbis/times) 8[![Coverage Status](https://coveralls.io/repos/djherbis/times/badge.svg?branch=master)](https://coveralls.io/r/djherbis/times?branch=master) 9[![Go Report Card](https://goreportcard.com/badge/github.com/djherbis/times)](https://goreportcard.com/report/github.com/djherbis/times) 10[![Sourcegraph](https://sourcegraph.com/github.com/djherbis/times/-/badge.svg)](https://sourcegraph.com/github.com/djherbis/times?badge) 11 12Usage 13------------ 14File Times for #golang 15 16Go has a hidden time functions for most platforms, this repo makes them accessible. 17 18```go 19package main 20 21import ( 22 "log" 23 24 "gopkg.in/djherbis/times.v1" 25) 26 27func main() { 28 t, err := times.Stat("myfile") 29 if err != nil { 30 log.Fatal(err.Error()) 31 } 32 33 log.Println(t.AccessTime()) 34 log.Println(t.ModTime()) 35 36 if t.HasChangeTime() { 37 log.Println(t.ChangeTime()) 38 } 39 40 if t.HasBirthTime() { 41 log.Println(t.BirthTime()) 42 } 43} 44``` 45 46Supported Times 47------------ 48| | windows | linux | solaris | dragonfly | nacl | freebsd | darwin | netbsd | openbsd | plan9 | js | 49|:-----:|:-------:|:-----:|:-------:|:---------:|:------:|:-------:|:----:|:------:|:-------:|:-----:|:-----:| 50| atime | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 51| mtime | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 52| ctime | ✓* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | 53| btime | ✓ | | | | | ✓ | ✓| ✓ | | 54 55* Windows XP does not have ChangeTime so HasChangeTime = false, 56however Vista onward does have ChangeTime so Timespec.HasChangeTime() will 57only return false on those platforms when the syscall used to obtain them fails. 58* Also note, Get(FileInfo) will now only return values available in FileInfo.Sys(), this means Stat() is required to get ChangeTime on Windows 59 60Installation 61------------ 62```sh 63go get gopkg.in/djherbis/times.v1 64``` 65