Open Bug 1574753 Opened 6 years ago Updated 5 years ago

TZ setting does not completely override

Categories

(SeaMonkey :: General, defect)

SeaMonkey 2.49 Branch
defect
Not set
normal

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: ohtmvyyn.zbmvyyn, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0

Steps to reproduce:

Set environment variable TZ(=PST8PDT) on Windows to override timezone.

Actual results:

Partially works. In Javascript Date.getTimezoneOffset() and Date.toLocaleString() and Date.toTimeString() appear more-or-less correct and reflect the overriding zone. However Intl.DateTimeFormat().resolvedOptions().timeZone still shows the Windows system zone name.

Expected results:

Intl.DateTimeFormat().resolvedOptions().timeZone should have shown "America/Los_Angeles" or similar.

At various points in the code there are localtime(), mktime(), etc api calls which obey, in a limited fashion, the TZ environment variable. They are documented by Microsoft to recognise TZ=tzn[+|-]hh[:mm[:ss]][dzn]

The reason for this bug is because of code in intl/icu/source/common/putil.cpp.

    uprv_tzname()
    {
        tzid = uprv_detectWindows()TimeZone();
        if (tzid) return tzid;
        tzid = getenv("TZ");
        ....
    }

Any ordinary interpretation of the word "override" would lend one to believe that the getenv("TZ") should be the first call in uprv_tzname() and not after the Windows detection (via GetGeoInfo() and GetTimeZoineInformation()). The TZ is supposed to pre-empt other methods of determining the timezone. It should not be that TZ acts as some sort of secondary item that gets used when the Windows api cannot be used to determine the timezone.

... typo above ... "uprv_detectWindowsTimeZone()"(In reply to Jay from comment #1)

At various points in the code there are localtime(), mktime(), etc api calls which obey, in a limited fashion, the TZ environment variable. They are documented by Microsoft to recognise TZ=tzn[+|-]hh[:mm[:ss]][dzn]

The reason for this bug is because of code in intl/icu/source/common/putil.cpp.

    uprv_tzname()
    {
        tzid = uprv_detectWindowsTimeZone();
        if (tzid) return tzid;
        tzid = getenv("TZ");
        ....
    }

Any ordinary interpretation of the word "override" would lend one to believe that the getenv("TZ") should be the first call in uprv_tzname() and not after the Windows detection (via GetGeoInfo() and GetTimeZoineInformation()). The TZ is supposed to pre-empt other methods of determining the timezone. It should not be that TZ acts as some sort of secondary item that gets used when the Windows api cannot be used to determine the timezone.

How can I delete or edit a bugzilla comment, by the way? Just to correct a simple typo or two. Seems a bit unintuitive. Or is this how it has always been?

How can I delete or edit a bugzilla comment, by the way?

You probably need editbugs rights. It was only recently activated. I also needed to switch to a current skin in my profile.

Could you retry with 2.53:
http://www.wg9s.com/comm-253/

Site should be back tomorrow or Sunday. The intl support was completely overhauled in Gecko 54 to 57 and everything I could find was backported to 2.53. There are new settings which supports the OS locale. Defaults to the installed language which is probably not what you want.

Back up your profile. Downgrading to 2.49.5 is not supported.

@reporter:
anything new here?

Flags: needinfo?(ohtmvyyn.zbmvyyn)

Not sure what you are looking for. This bug report is 1 year old so I guess that must mean it is new.

Flags: needinfo?(ohtmvyyn.zbmvyyn)

(In reply to Jay from comment #6)

Not sure what you are looking for. This bug report is 1 year old so I guess that must mean it is new.

@Reporter
Frank-Rainer Grahl (:frg) suggested that you should test SeaMonkey 2.53. Did you? What are your test results?

Just reading the new code in 2.53 I can see it is exactly the same in so as far as the bug is concerned.

In both 2.49 and 2.53 the code in uprv_tzname() is effectively the same viz:

uprv_tzname()
{
    if ((tzid = uprv_detectWindowsTimeZone()))
       return;

   if ((tzid = getenv("TZFILE")))
        return;

   tzid = getenv("TZ");
   ...
}

The point being that in 2.53 the detectWindowsTimeZone() take precedence over TZ environment. The TZ environment should override everything, including the detectWindowsTimeZone().

So instead of pushing back with trying to get me to test 2.53 on your behalf you might have simply read the snippet of code in both 2.45 and 2.53. That surely should be a pre-requisite even if so as to just re-familiarize yourself with that area of code? When you say intl code was completely overhauled it would seem that some of it still remains. In any case, the code really has little to do with intl preferences, and is instead about timezones.

In both 2.49 and 2.53 the code in uprv_tzname() is effectively the same viz:

Basically this is the same in the latest mozilla code too and was explicitly added to the mozilla icu source used.

So instead of pushing back with trying to get me to test 2.53 on your behalf

Yes I can read snipplets but the sourrounding code changed between 2.49 and 2.53.

As fas as I see it this should affect current Firefox too. So someone needs to test it and if yes the bugs needs to be moved to icu.

You need to log in before you can comment on or make changes to this bug.