[jcifs] Quick dumb timezone question

Christopher R. Hertel crh at ubiqx.mn.org
Thu Sep 5 16:18:10 EST 2002


"Allen, Michael B (RSCH)" wrote:
> 
> > -----Original Message-----
> > From: Christopher R. Hertel [SMTP:crh at ubiqx.mn.org]
> > Sent: Thursday, September 05, 2002 12:40 AM
> > To:   jcifs at samba.org
> > Subject:      [jcifs] Quick dumb timezone question
> >
> > I'm confused about the ServerTimeZone field in the NegProt response.
> > I would have thought that it would have been a signed value, with
> > positive values for east of Greenwich and negative values for west.
> > The docs say it's signed, however.

Typo.  The docs say it's UNsigned.

> >
>         Right. It's signed.

...but you are saying it is signed (which makes more sense to me).

> > How is this field used?
> >
>         Well I have an app that searches a bunch of drives around the
>         globe in
>         parallel for files. Here are some data points. You figure it out.
> 
>         San Francisco      420
>         New York           240
>         Toronto            240
>         London            -60
>         Hong Kong         -480
>         Singapore         -480
>         Tokyo             -540
>         Melbourne         -600

I can figure that out just fine.  Are these actual values from the actual
ServerTimeZone fields from actual NegProt Responses from Windows systems?
Kewl!  If that's what they are then both the SNIA doc and the Leach draft
have it wrong.  What's wierder, though, is that New York is generally
considered EST5EDT which (this time of year) would be -240.  Negative, not
positive.  I think that Microsoft reverses the signs because they keep
localtime, not UTC, on their systems.

>         But this is not a quick dumb question. It's complicated.
>         Actually the SNIA doc has a bit more about how you take into
>         account daylight savings time.

...which it says is only taken into account when dealing with file
timestamps, not with the server time in the NegProt response.

>         Look at writeTime() in ServerMessageBlock.java. But some regions
>         use daylight
>         savings and some don't. If the server is in a different
>         hemisphere and you're in daylight savings, then wouldn't times
>         need to be adjusted whereas with a server in the same hemisphere
>         you would not adjust? Currently I calculate daylight
>         savings correction for *the time being encoded* based on *my*
>         timezone.

It gets worse.  There are parts of Indiana that don't do Daylight Savings
Time.  Other parts do.  Ouch.  (Maybe that's changed in the last few years,
but I remember it from when I lived in Chicago.)

>         Doesn't the *servers* timezone need to be considered? Last I
>         checked times
>         in different TZs work just fine but it would be great if you
>         could answer these
>         questions definitively. I'm not crytal clear on it.

I'm just working on the SystemTimeLow, SystemTimeHigh, and ServerTimeZone
fields in the NegProt response right now.  One step at a time...
Using those fields, though, you can know the servers local time and its
offset from UTC.  What you don't know, as you correctly point out, is
whether the server is using Daylight Savings Time or not.  I'm not sure
if that's needed information... could be but I'm getting sleeping and I
can't think it through just now.  Later.

Chris -)-----

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