Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Style question: Can this be written in a more elegant way?



On Apr 25, 10:01am, Marc Chantreux wrote:
} Subject: Re: Style question: Can this be written in a more elegant way?
} 
} > [OT] How exact are time stamps on files?
} 
} man stat

That's not very helpful.  "man 2 stat" might be better, but not much.  On
my system, neither of them explains what a time_t represents.

The stored accuracy of file time stamps varies by operating system
implementation.  For practical shell programming purposes, though, it
has one-second granularity.  Modern computers can create or modify a
lot of files in one second.
 
} > If, basically, a time_t value is choosen for a time stamp, then in
} > practice the only possibility for two files to come up with the
} > same time stamp, is when the time stamp is explicitly supplied via
} > "touch", isn't it?
} 
} I think you're right but i'm not an expert.

Even if you're somehow prevented from writing more than one file per
second, there are a LOT of ways two files could get the same stamp.
Just a few I can think of immediately:
 - hard-link a file to a second name with "ln"
 - copy a file with "cp -a" or "tar" etc.
 - set the system clock back (e.g., ntpd adjusting for drift)



Messages sorted by: Reverse Date, Date, Thread, Author