[jcifs] timezone problems

Christopher R. Hertel crh at ubiqx.mn.org
Mon Mar 8 20:57:33 GMT 2004

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.

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:
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
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.

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 

Mike?  I wonder if LastWriteTime in SMB_CLOSE is really SMB_DATE and 
SMB_TIME or some other format.  Hmmm....

Interesting issue.

Chris -)-----

"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org

More information about the jcifs mailing list