rounding timestamps (or not)

Björn Jacke bj at
Mon Sep 13 04:11:23 MDT 2010


in round_timespec() from source3/lib/time.c there is rounding being done for
second resolution but for usec resulition therer is only being truncated.
Currently the only user of round_timespec() is smb_set_file_time. Even if it's
it looks like one microsecond more or less make no big difference here, the
rounding at this place should probably be made consistent.

I wonder if it's really a good idea to round here at all. If an application
sets times on a file and later on sees that the file has a newer timestamp that
it thinks that it set just before it will result in strange effects. Thinking
about it right now. I think of bugs like Office complaining that a file has
been modified after the the last write and so on. Jeremy, as this code was last
touched by you, what do think?  Isn't truncating the times the better approach,
e.g. move round_timespec() to trunc_timespec()?

SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list