[jcifs] timezone problems
julian.reschke at gmx.de
Mon Mar 8 23:29:55 GMT 2004
Christopher R. Hertel wrote:
> If the time being reported via SMB is based on the *server's* local time,
> then the client must convert the time to the *client's* local time. To do
> this, it uses the server time reported in the SMB Negotiate Protocol
> Response. That's that weird bozosecond timestamp. The client must
> compare the server's time against its own local time to calculate the
Well, no. First of all, whatever the format on the wire is, JCifs needs
to convert it to *UTC* (that is GMT w/o DST) first, because this is the
format used by Java for timestamps (at least as java.io.File and SmbFile
Conversion to local timezones and DST considerations need to be done in
the code *on top of* JCifs (for instance, by construcing Java Date
objects and by formatting them using Java's locale support).
> Note that calculating the time for display on the client does involve Java
> doing a lot of time manipulations locally. There's lots of opportunities
> for subtle bugs at all levels.
Yes. But this shouldn't occur at that level. SmbFile is a filie I/O API,
not a user interface, and it's supposed to use UTC, not local time (at
least I would assume so because this is was java.io.File does).
> Does jCIFS return differnt values when running on, say, Linux vs. W2K and
> accessing the same file?
I'll try tomorrow.
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760
More information about the jcifs