On Wed, May 16, 2012 at 11:15 PM, SethP <[email protected]> wrote:
> 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.

I see what you mean, it happens on Linux too. Does this patch[1] fix
it? It's against master but it probably applies to v0.6 as well:

[1] https://gist.github.com/71255d724b46f40693a1

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

Reply via email to