On Wednesday, May 16, 2012 9:06:12 AM UTC-4, Ben Noordhuis wrote:
> > Thanks, Ben - I figured you'd be the one to pick this up. (btw - how do
> you
> > pronounce your name?)
>
> 'North house' is a close enough approximation. :-)
>
Thanks for clearing that up for everyone. Maybe that can go in the group
FAQ? :o)
>
> > The reason I think it may be a bug is that the output of the test script
> > (sans assertion) is as follows:
> >
> > Tue May 15 2012 19:21:53 GMT-0700 (PDT)
> > 1326405600000 Thu Jan 12 2012 14:00:00 GMT-0500 (EST)
> > 1326405600000 Thu Jan 12 2012 17:00:00 GMT-0500 (EST)
> >
> > Two dates have identical getTime() values but different hours with the
> > *same* tzinfo (EST). Regardless of which TZ is the current one, that
> should
> > never happen, correct? It's a matter of internal consistency; one of
> those
> > lines has got to be wrong. (The bottom line is correct; the date appears
> to
> > be parsed as though the TZ is still America/LA)
>
> Yes, that's a V8 bug. It's mostly* fixed in master.
>
> Your example still won't work quite right (the assertion will fail)
> unless you `export TZ="America/New_York"` before running the script.
> That can't really be helped, I'm afraid.
>
> * There is still a bug in timezone handling on Solaris.
>
Good to know. I've abandoned my dumb approach and am now using node-time
(which appears to have some oddities of its own lurking in the corner
cases).
I figured something must be caching the TZinfo; here's a script that shows
some perplexing behavior on OS X:
var d;
console.log(new Date().toString());
process.env.TZ = 'America/Los_Angeles';
d = new Date('2012-1-12 02:00 PM');
console.log(new Date().toString());
process.env.TZ = "America/New_York";
d = new Date('2012-1-12 02:00 PM');
console.log(new Date().toString());
process.env.TZ = 'America/Los_Angeles';
d = new Date('2012-1-12 02:00 PM');
console.log(new Date().toString());
process.env.TZ = 'America/Chicago';
d = new Date('2012-1-12 02:00 PM');
console.log(new Date().toString());
process.env.TZ = 'Hongkong';
d = new Date('2012-1-12 02:00 PM');
console.log(new Date().toString());
process.env.TZ = "America/New_York";
d = new Date('2012-1-12 02:00 PM');
console.log(new Date().toString());
When run with $TZ == undefined, I *usually* get:
Wed May 16 2012 17:06:22 GMT-0400 (EDT)
Wed May 16 2012 14:06:22 GMT-0700 (PDT)
Wed May 16 2012 14:06:22 GMT-0700 (PDT)
Wed May 16 2012 14:06:22 GMT-0700 (PDT)
Wed May 16 2012 14:06:22 GMT-0700 (PDT)
Wed May 16 2012 14:06:22 GMT-0700 (PDT)
Wed May 16 2012 14:06:22 GMT-0700 (PDT)
But every now and then I get:
Wed May 16 2012 17:10:14 GMT-0400 (EDT)
Wed May 16 2012 14:10:14 GMT-0700 (PDT)
Wed May 16 2012 17:10:14 GMT-0400 (EDT)
Wed May 16 2012 17:10:14 GMT-0400 (EDT)
Wed May 16 2012 17:10:14 GMT-0400 (EDT)
Wed May 16 2012 17:10:14 GMT-0400 (EDT)
Wed May 16 2012 17:10:14 GMT-0400 (EDT)
And on rare times I get:
Wed May 16 2012 17:09:25 GMT-0400 (EDT)
Wed May 16 2012 14:09:25 GMT-0700 (PDT)
Wed May 16 2012 14:09:25 GMT-0700 (PDT)
Wed May 16 2012 14:09:25 GMT-0700 (PDT)
Wed May 16 2012 16:09:25 GMT-0500 (CDT)
Thu May 17 2012 05:09:25 GMT+0800 (HKT)
Wed May 16 2012 17:09:25 GMT-0400 (EDT)
Which I'd normally think was a race condition somewhere, but it's not
apparent to me where there'd be a race. For added fun you can export TZ=GMT
or something to spice it up; it's just stochastic as hell.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en