[jcifs] timezone problems

Julian Reschke julian.reschke at gmx.de
Mon Mar 8 21:10:59 GMT 2004


Christopher R. Hertel wrote:

> On Mon, Mar 08, 2004 at 09:19:43PM +0100, Julian Reschke wrote:
> 
>>Michael B Allen wrote:
>>
>>>Julian Reschke said:
>>>
>>>
>>>>I'm not sure why JCifs is trying to compensate for DST differences here.
>>>
>>>
>>>Because it's required to generate the correct time. See the CIFS docs for
>>>details.
>>
>>Can you point to a specific section...?
> 
> 
> Section 3.7.

Thanks. In the meantime I also found it in the SNIA document (is this 
what you're referring to). However, it seems to be missing in 
<http://ubiqx.org/cifs/rfc-draft/draft-leach-cifs-v1-spec-02.html>, 
section 3.5.

> Note that there are lots of different formats.  The NegProt Response
> returns a TIME structure, which gives the time since January 1, 1601,
> 00:00:00.0 UTC in tenths of a microsecond (aka. bozoseconds).  For more 
> info on the TIME structure see:
>   http://ubiqx.org/cifs/SMB.html#SMB.6.3.1
> Scroll down to the header that reads "SystemTimeLow and SystemTimeHigh".


> There's also an SMB_TIME and SMB_DATE structure.  Note that the SMB_TIME
> structure's finest resolution is 2-second intervals.  I *beleive* that
> this is the format used by FAT to store file timestamps.  Search through

That's correct.

> the document to find further references to SMB_TIME.  It's used to report
> file timestamps.
> 
> 
>>Do we agree that the correct time *indeed* is measured in milliseconds 
>>since the Epoch? Why would that value depend on DST settings on either 
>>client or server?
> 
> 
> Nope.  :)
> 
> In the early days of the PC you had to set the time at boot-up.  That was
> before they put battery-backed clocks onto the motherboard.  The time was
> always handled as local time, and DOS & FAT were written for that
> environment.  I'm going to guess that file timestamps in FAT are stored in 
> local time, with a 2-second resolution.

I sure remember that time, although back then I wasn't developing on the 
PC platform :-)

> Once jCIFS reads that info it may convert to milliseconds since the (Unix) 
> Epoch and work from there.
> 
> Note that the SNIA CIFS doc does define something called UTIME.  I am 
> surprised by this.  I'm not sure how (if) it's used.  It is supposedly 
> used in SMB_CLOSE, but I recall Mike having trouble using that field in 
> testing.
> 
> Mike?  I wonder if LastWriteTime in SMB_CLOSE is really SMB_DATE and 
> SMB_TIME or some other format.  Hmmm....
> 
> Interesting issue.
> 
> Chris -)-----

Chris,

thanks for the information, but all this doesn't change the fact that 
I've got a test case 
(<http://lists.samba.org/archive/jcifs/2004-February/002942.html>) that 
*demonstrates* that the timestamp misbehaves, at least on two systems 
(W2000 and W2003). It simply doesn't match what both java.io.File 
returns (and SmbFile is supposed to be compatible, right?).

Maybe the adjustment is only needed for servers that do *internally* 
operate in local time???


Regards, Julian

-- 
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760


More information about the jcifs mailing list