Closed Bug 719274 Opened 14 years ago Closed 8 years ago

Date::toString() produces wrong timezone abbreviation

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jasen, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20111108 Iceweasel/3.5.16 (like Firefox/3.5.16) Build ID: 20111108195557 Steps to reproduce: basically I called toString on a Date object eg: like below (linux, TZ=Pacific/Auckland) <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>test</title></head><body> <p> now: <script type="text/javascript"> var now=new Date(); document.write(now.toString()); </script> </p></body></html> Actual results: I got this content: now: Thu Jan 19 2012 12:54:27 GMT+1300 (NZST) Here the parenthesized timezone abbreviation NZST is incorrect it should be NZDT the "GMT+1300" part is correct, NZDT is GMT+1300 , NZST is GMT+1200. Other software like /bin/date gets the correct timezone. Expected results: I'm guessing it should say, I haven't found any documentation about exactly what is supposed to happen. now: Thu Jan 19 2012 12:54:27 GMT+1300 (NZDT) in bug25447 it is claimed that '%Z' is used with strftime() to get the timezone name but I am seeing NZDT when I call strftime (I used the sample code from the linux strftime manpage), i gdb output on the call to strftime: Breakpoint 1, *__GI_strftime (s=0x7fff400b0cb0 "\330\r\v@\377\177", maxsize=100, format=0x7eff52ca75ee "(%Z)", tp=0x7fff400b0b70) at strftime.c:27 27 strftime.c: No such file or directory. in strftime.c (gdb) p *tp $1 = {tm_sec = 34, tm_min = 16, tm_hour = 0, tm_mday = 19, tm_mon = 0, tm_year = 112, tm_wday = 4, tm_yday = 18, tm_isdst = 1, tm_gmtoff = 43200, tm_zone = 0x7eff431144d0 "NZST"} looks like a GIGO problem, perhaps you're calling strftime with invalid input.
sorry if the above it a bit confusing, the gdb output is from firefoxs call to strftime.
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
QA Contact: untriaged → general
Version: 3.5 Branch → unspecified
WRM on Windows 7: $ js -e 'print((new Date).toString())' Fri Jan 20 2012 14:48:25 GMT+1300 (New Zealand Daylight Time) Need to get tested on Linux.
On Linux: [jwalden@wheres-wally src]$ TZ=Pacific/Auckland dbg/js -e 'print((new Date).toString())' Fri Jan 20 2012 14:51:19 GMT+1300 (NZDT) That seems to be right, if I'm skimming the commentary here correctly, and if I'm doing the right thing to switch to the proper time zone.
(In reply to jasen from comment #0) > User Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) > Gecko/20111108 Iceweasel/3.5.16 (like Firefox/3.5.16) > Build ID: 20111108195557 Hmmm, what build is that, exactly? Since it seems to work with our local builds, I'm wondering if it's a bug that got fixed since whenever that build was made?
(In reply to Jeff Walden (remove +bmo to email) from comment #3) > On Linux: > > [jwalden@wheres-wally src]$ TZ=Pacific/Auckland dbg/js -e 'print((new > Date).toString())' > Fri Jan 20 2012 14:51:19 GMT+1300 (NZDT) > > That seems to be right, if I'm skimming the commentary here correctly, and > if I'm doing the right thing to switch to the proper time zone. That result looks correct. how the timezone is set here: $ cat /etc/timezone Pacific/Auckland But I would expect "export TZ=Pacific/Auckland" to have the same effect. (In reply to David Mandelin from comment #4) > (In reply to jasen from comment #0) > > User Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) > > Gecko/20111108 Iceweasel/3.5.16 (like Firefox/3.5.16) > > Build ID: 20111108195557 > > Hmmm, what build is that, exactly? Since it seems to work with our local > builds, I'm wondering if it's a bug that got fixed since whenever that build > was made? It's the Debian 6.0.3 package "iceweasel" version 3.6.16-11 x86_64 binary AIUI Debian mainly focuses on security patches, so if there was a bugfix patch it may not have come through.
Assignee: general → nobody
No longer reproducible for me (with or without https://hg.mozilla.org/mozilla-central/rev/b7ef07909cc4), therefore marking as WFM.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.