times

#golang file times (atime, mtime, ctime, btime)

  • 所有者: djherbis/times
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

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, :-----:, :-------:, :-----:, :-------:, :---------:, :------:, :-------:, :----:, :------:, :-------:, :-----:, :-----:, 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

主要指标

概览
名称与所有者djherbis/times
主编程语言Go
编程语言Go (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2015-08-29 07:08:15
推送于2023-10-20 15:09:49
最后一次提交2023-10-03 17:12:34
发布数10
最新版本名称v1.6.0 (发布于 )
第一版名称v0.9.0 (发布于 )
用户参与
星数271
关注者数6
派生数29
提交数116
已启用问题?
问题数7
打开的问题数1
拉请求数7
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?