basicfs_fileinfo_bsdish.go 547 B

1234567891011121314151617181920212223
  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 darwin || freebsd || netbsd
  7. // +build darwin freebsd netbsd
  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.Ctimespec.Nano())
  16. }
  17. return time.Time{}
  18. }