[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] copying file timestamps (was: utimes.m4)
From: |
Bruno Haible |
Subject: |
Re: [Bug-gnulib] copying file timestamps (was: utimes.m4) |
Date: |
Tue, 19 Aug 2003 13:23:36 +0200 |
User-agent: |
KMail/1.5 |
Paul Eggert wrote:
> copy-file.c prefers utime to utimes, so it should be fine too.
> I don't know of any host that lacks utime and has a broken utimes.
OK, thanks for explaining.
But since utimes() can set the file's times with microsecond resolution,
what is the portable way to _get_ a file's times with more than 1 second
resolution?
glibc with __USE_MISC has
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
glibc without __USE_MISC has
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
FreeBSD with __BSD_VISIBLE has
struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */
struct timespec st_ctimespec; /* time of last file status change */
FreeBSD without __BSD_VISIBLE has
time_t st_atime; /* time of last access */
long st_atimensec; /* nsec of last access */
time_t st_mtime; /* time of last data modification */
long st_mtimensec; /* nsec of last data modification */
time_t st_ctime; /* time of last file status change */
long st_ctimensec; /* nsec of last file status change */
Solaris 7 with __EXTENSIONS__ has
timestruc_t st_atim;
timestruc_t st_mtim;
timestruc_t st_ctim;
Solaris 7 without __EXTENSIONS__ has
_timestruc_t st_atim;
_timestruc_t st_mtim;
_timestruc_t st_ctim;
I'd like to use these in copy-file.c. Do you already have an autoconf
macro for this?
> Perhaps we should make utimens a gnulib module. tar will need
> something like it once tar adds support for subsecond timestamps.
Yes, I agree. One module for getting the subsecond timestamp, and one
for setting it, would be perfect.
Bruno