On Wed, 2012-09-26 at 14:56 -0600, Josue Abarca wrote: > On Wed, Sep 26, 2012 at 06:46:16PM +0100, Richard Shann wrote: > > There is a problem with the print view update which comes down to the > > question: How do you tell if a file has changed. > > Currently I am using stat() and looking at mtime, but only the seconds > > are being stored it seems, no sub-second precision. > > What is the right way to test if a file has changed? > > Richard > > According to [0] and [1] you can use stat and look at mtim (note: no > trailing e). > > st_mtim.tv_nsec <- to see the nano seconds. > > (of course the file system must support nanoseconds time stamps) Thanks - it seems I have been on the right track - I was looking at tv_nsec in the debugger and it is always 0. IIRC Debian stable uses ext2 filesystem - could it be that it doesn't record nano-second timestamps? Even if it didn't have the precision to give accurate information it could always increment tv_nsec by 1 every time it modified a file with the same value of tv_sec. If this is really the situation I guess I should find another way - I need to do something for the Windows system anyway as that doesn't do file locking the same way as unix. So I will maybe need to keep changing the filename that LilyPond stores to, though it is nice to keep the old one for viewing...
Richard > > [0] > http://stackoverflow.com/questions/5086471/how-to-display-file-last-modification-time-on-linux#tab-top > [1] http://linux.die.net/man/2/stat > _______________________________________________ Denemo-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/denemo-devel
