Re: 3 letter timezones (was month name to number)

2003-06-11 Thread Joshua Hoblitt
 Any progress on this?

I seem to recall that Rick volunteered to do it but I don't see that in the thread.  I 
just started work on it anyways.  If Rick already has something we can just use that 
instead.

-J

--



Re: 3 letter timezones (was month name to number)

2003-06-11 Thread Ben Bennett
Cool.  I want to mention it in the FAQ and I want to use it in the
Complex parser...

-ben

On Wed, Jun 11, 2003 at 03:33:09PM -1000, Joshua Hoblitt wrote:
  Any progress on this?
 
 I seem to recall that Rick volunteered to do it but I don't see that in the thread.  
 I just started work on it anyways.  If Rick already has something we can just use 
 that instead.
 
 -J
 
 --


Re: 3 letter timezones (was month name to number)

2003-06-11 Thread Rick Measham
On 12/6/03 11:33 AM, Joshua Hoblitt at [EMAIL PROTECTED] spake thus:

 Any progress on this?
 
 I seem to recall that Rick volunteered to do it but I don't see that in the
 thread.  I just started work on it anyways.  If Rick already has something we
 can just use that instead.

Strptime contains a list of three-letter timezones, however if you have a
look you'll see that it returns 'ambiguous' on any that were ambiguous. I
can recreate it with all the information if you want.

Cheers!
Rick



Re: 3 letter timezones (was month name to number)

2003-06-11 Thread Joshua Hoblitt
  Any progress on this?
 
  I seem to recall that Rick volunteered to do it but I don't see that in the
  thread.  I just started work on it anyways.  If Rick already has something we
  can just use that instead.

 Strptime contains a list of three-letter timezones, however if you have a
 look you'll see that it returns 'ambiguous' on any that were ambiguous. I
 can recreate it with all the information if you want.

I've got something working (basic proof of concept - what do you expect 23mins :) ).  
I'm writing a couple of quick tests and I post it for comments shortly.

-J

--



Re: 3 letter timezones (was month name to number)

2003-06-10 Thread Ben Bennett
Any progress on this?

 -ben

On Wed, Apr 30, 2003 at 12:30:01PM +1000, Rick Measham wrote:
  On Tue, 29 Apr 2003, Joshua Hoblitt wrote:
  I was thinking of something similar to the 'constant' syntax that
  quietly creates namespaces.
  
  use DateTime::TimeZone::Alias HST = 'US/Hawaii';
  .
  .
  
  my $dt = DateTime-new( year = 2003, time_zone = 'HST' );
  
  That seems like the most tidy way of doing things.  Of course I won't
  have time to work on this for several days so I may not get a vote. :)
 
 On 30/4/03 11:42 AM, Dave Rolsky at [EMAIL PROTECTED] spake thus:
  The problem is that parsers need more than this, since they can't just set
  a static list of aliases in advance.  They have to be able to have EST be
  interpreted in multiple ways.
 
 I'm looking at setting a range of 'standard' aliases and allowing options:
 
 use DateTime::TimeZone::Alias EST = 'Australia/Melbourne';
 my $dt = DateTime-now( time_zone = 'EST' );
 print $dt-offset;
 # Returns 36000
 
 use DateTime::TimeZone::Alias EST = 'America/New_York';
 my $dt = DateTime-now( time_zone = 'EST' );
 print $dt-offset;
 # Returns -14400 even though EST is standard time and NY is in Daylight time
 because EST is mapped to 'America/New_York'.
 
 use DateTime::TimeZone::Alias;
 my $dt = DateTime-now( time_zone = 'EST' );
 print $dt-offset;
 # Returns -14400 (assumes most people will be thinking about USA).
 
 Apart from the standard zones I'd include other ones like using 'AEST/V' and
 'AEST/M' for Australian Eastern Standard/Summer time in Victoria.
 
 'AEST' would default to Sydney (as would 'AEST/NSW' and 'AEST/S') simply
 because most people would be expecting Sydney (most of the world seem to
 think it's our capital city!)
 
 use DateTime::TimeZone::Alias 'I have a lovely bunch of coconuts' =
 'America/Hawaii';
 my $dt = DateTime-now( time_zone = 'I have a lovely bunch of coconuts' );
 # Obviously the result is Hawaii, I just added this to demonstrate the
 ability to use anything as an alias.
 
 I'd also include the A-Z zones (And might even include Adelaide and other
 1/2 hour zones as 'X.5'!)
 
 Hmmm .. as I type this I wonder if we should also allow aliasing to custom
 zones:
 my %NO_DST = (
 dst_start_month = 0,
 dst_start_day   = 0,
 dst_start_hour  = 0,
 dst_end_month   = 0,
 dst_end_day = 0,
 dst_end_hour= 0,
 offset  = 36000,
 dst_offset  = 36000,
 );
 use DateTime::TimeZone::Alias EST = \%NO_DST;
 my $dt = DateTime-now( time_zone = 'EST' );
 print $dt-offset;
 # Returns 36000
 
 For setting things 'permanently' maybe we should read
 $ENV{DATETIME_TZ_ALIAS} and ~/.DATETIME_TZ_ALIAS
 
 Developers hooking onto aliases really should either:
 1. Provide their own aliases
 2. Provide their own data file
 3. Not mind if things get screwy
 4. Get run over by a large bus.
 
 
 Cheers!
 Rick