On Mon, 30 Mar 2015, Konstantin Belousov wrote:

On Mon, Mar 30, 2015 at 03:14:10PM +1100, Bruce Evans wrote:
File timestamps use CLOCK_REALTIME, so they are supposed to go backwards
sometimes.  More importantly, if the time is set to a future time (by
utimes(), etc., not due to a clock step), this prevents it being correted.
I think you only want to do a null update if tv_nsec is nonzero due to a
previous setting with vfs_timestamp(), and the new second hasn't arrived
yet.  Something like:

                if (tsp->tv_sec != ts) ...

If '<', then as above.  If '>', it means a correction by >= 1 second
(strictly greater if tv_nsec != 0).  The initial value tv_nsec is
irrelevant in both cases.

The future times happen often in practice.  Any time the system is on
local time East of Greenwich, using a device file early in the boot
sets its timestamps in the future (9-11 hours here).  Then using the
file later should set it to the current time without waiting until
the future time is reached.

Below is the updated patch.  I also added a comment to devfs_timestamp(),
please reformulate it to your liking.

I like this version.

Bruce
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to