DateTime.parse and long time zone names

I'm too paranoid to use a 1.9 lib, so I resorted to this:

LONG_TZ = /(Mountain|Central|Eastern|Pacific)+\s(\w+?)\s(\w+?)\s.*/

# Where +time+ is the result of a Time.now.to_s call
if match = LONG_TZ.match(time)
   tz = ""
   old = match.captures.join(" ")
   match.captures.each{ |word| tz += word[0].chr }
   time.sub!(old, tz)
end

Regards,

Dan

···

-----Original Message-----
From: Ara.T.Howard [mailto:Ara.T.Howard@noaa.gov]
Sent: Wednesday, October 19, 2005 3:36 PM
To: ruby-talk ML
Subject: Re: DateTime.parse and long time zone names

On Thu, 20 Oct 2005, Berger, Daniel wrote:

> Hi all,
>
> Does anyone out there have a patch to date/format.rb (i.e.
> DateTime.parse) that handles long time zones, e.g.
"Mountain Daylight
> Time" versus "MDT"?
>
> I thought I would ask before I started hacking on it.

   irb(main):014:0> Time::parse "Wed Oct 19 15:33:41 Mountain
Daylight Time 2005"
   => Wed Oct 19 15:33:41 MDT 2005

   irb(main):015:0> RUBY_VERSION
   => "1.9.0"

maybe you can upgrade only this file... dunno.

-a