• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

example/H31-Dec-2018-9778

.travis.shH A D31-Dec-2018615 2822

.travis.ymlH A D31-Dec-2018364 1919

LICENSEH A D31-Dec-20181.1 KiB2317

README.mdH A D31-Dec-20182.3 KiB6551

bench_test.goH A D31-Dec-2018834 5749

ctime_windows.goH A D31-Dec-20183.3 KiB150118

js.cover.dockerfileH A D31-Dec-2018286 96

js.cover.shH A D31-Dec-2018272 75

times.goH A D31-Dec-20181.5 KiB7548

times_darwin.goH A D31-Dec-2018836 4127

times_dragonfly.goH A D31-Dec-2018779 4026

times_freebsd.goH A D31-Dec-2018837 4127

times_js.goH A D31-Dec-2018823 4226

times_linux.goH A D31-Dec-2018775 4026

times_nacl.goH A D31-Dec-2018804 4026

times_netbsd.goH A D31-Dec-2018836 4127

times_openbsd.goH A D31-Dec-2018777 4026

times_plan9.goH A D31-Dec-2018643 3522

times_solaris.goH A D31-Dec-2018777 4026

times_test.goH A D31-Dec-20182.3 KiB126102

times_windows.goH A D31-Dec-2018763 3724

times_windows_test.goH A D31-Dec-20181.4 KiB7664

use_generic_stat.goH A D31-Dec-2018334 168

util_test.goH A D31-Dec-20181.8 KiB8265

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