Dear Samba Team.
I have been wondering how samba (2.0.7) is converting NT-timestamps (with
microseconds) to Linux-timestamps (only seconds). Sometimes it rounds msecs up
(sec+1), sometimes it simply cuts msec off.
Then I have found "nt_time_to_unix" in source/lib/time.c
Obviously it uses double-fp-arithmetic to deal with the 64 bit NT-timestamp.
But 64 bit double is not the same as 64 bit integer ! Some bits are used for the
exponent, so there is only 16 digits precision of the mantissa. 64 bit integer
has 18 digits.
This is the reason for inaccurate timestamp conversion.
How to solve ?
Use 64 bit integer on 64 bit machines (like mine, DEC AXP).
Or: Divide nt.high and nt.low by 256 to get smaller numbers. Combine them by
adding an divide the sum by (1E7/256).
This leaves nearly two digits of the msec-part of the time-stamp. Rounding up is
no problem then.
Markus.