From: Wayne Scott Date: 2001-05-05T01:52:30+09:00 Subject: [ruby-talk:14652] I can't use -w because of date.rb Let's try something less controversial... I can't use the 'ruby -w' any programs that use the Date module included with ruby. An example: $ ruby -v ruby 1.6.3 (2001-03-28) [i386-linux] $ ruby -w require "date" Date.new(2003,3,4).cwyear ^D (eval):4: warning: instance variable @__9569__ not initialized (eval):4: warning: instance variable @__9041__ not initialized $ /usr/local/bin/ruby -v ruby 1.7.0 (2001-05-02) [i686-linux] $ /usr/local/bin/ruby -w require "date" Date.new(2003,3,4).cwyear ^D (eval):4: warning: instance variable @__9785__ not initialized (eval):4: warning: instance variable @__9257__ not initialized Those warning come anytime the library is used. Suggestions: I would love it if the builtin Time class included a 'parse' method that worked like ParseDate, but did timezones correctly. As far as I can tell you can't create a Time object with a zone other than local or GMT. (*) I also want to be able to get workweek and year from a Time. (cwday, cweek in Date) -Wayne * I found this in the archives: require 'parsedate' class Time def Time.parse( timestr ) year, month, day, hour, min, sec, zone, wday = ParseDate.parsedate( timestr ) tm = Time.gm( year, month, day, hour, min, sec ) return tm unless zone return tm if zone.to_i == 0 hour = zone[0,3].to_i * 3600 min = zone[3,2].to_i * 60 ofs = (hour + min) return Time.at( tm.to_f - ofs ) end end Perhaps this should be added to parsedate. It still fails in the timezone is a string.