basicfs_fileinfo_linuxish.go 595 B

12345678910111213141516171819202122
  1. // Copyright (C) 2022 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. //go:build aix || dragonfly || linux || openbsd || solaris || illumos
  7. // +build aix dragonfly linux openbsd solaris illumos
  8. package fs
  9. import (
  10. "syscall"
  11. "time"
  12. )
  13. func (fi basicFileInfo) InodeChangeTime() time.Time {
  14. if sys, ok := fi.FileInfo.Sys().(*syscall.Stat_t); ok {
  15. return time.Unix(0, sys.Ctim.Nano())
  16. }
  17. return time.Time{}
  18. }