1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

nanosecond timestamp support in stat and utime

* libguile/posix.h:
* libguile/posix.c (scm_utime): Add optional nanosecond arguments. This
  is an incompatible change on the C level, but it's unlikely people are
  using this POSIX wrapper function, because they would just use the
  POSIX function directly. Hopefully, anyway.

* module/system/base/compile.scm (call-with-output-file/atomic):
  Propagate source timestamps to targets with nanosecond precision, if
  available. Fixes build on systems with ext4 filesystems.

* libguile/filesys.c (scm_stat2scm):
* module/ice-9/posix.scm (stat:atimensec, stat:mtimensec)
  (stat:ctimensec): Add three new elements to Scheme stat structures,
  for nanosecond-level timestamps.

* configure.ac: Add checks for utimensat, and for nanosecond fields in
  struct stat. We should switch to using Gnulib things for these,
  though.

* doc/ref/posix.texi (File System): Add documentation for utime's
  additional arguments, and nanosecond stat timestamp accessors.
This commit is contained in:
Andy Wingo 2010-01-17 16:56:21 +01:00
parent f826a8864a
commit 06bfe276c8
7 changed files with 120 additions and 23 deletions

View file

@ -33,6 +33,9 @@
(define (stat:ctime f) (vector-ref f 10))
(define (stat:blksize f) (vector-ref f 11))
(define (stat:blocks f) (vector-ref f 12))
(define (stat:atimensec f) (vector-ref f 15))
(define (stat:mtimensec f) (vector-ref f 16))
(define (stat:ctimensec f) (vector-ref f 17))
;; derived from stat mode.
(define (stat:type f) (vector-ref f 13))

View file

@ -88,7 +88,9 @@
(close-port tmp)
(if reference
(let ((st (stat reference)))
(utime template (stat:atime st) (stat:mtime st))))
(utime template
(stat:atime st) (stat:mtime st)
(stat:atimensec st) (stat:mtimensec st))))
(rename-file template filename))
(lambda args
(delete-file template)))))))