From: Charlie Bowman Date: 2006-02-14T04:44:09+09:00 Subject: Re: DateTime.parse speed question --=-m7AGCX8b8y0ewkWeBkvX Content-Type: text/plain Content-Transfer-Encoding: 7bit Thanks! On Tue, 2006-02-14 at 04:34 +0900, Jamey Cribbs wrote: > Charlie Bowman wrote: > > >The Time class doesn't appear to have any methods to parse a string into > >a time object or to find the difference of two times. How can this be > >done without using the DateTime class? > > > > > As Mike Fletcher answered in another email, there is a Standard Library > module called Time, that you can require into your script. This adds a > parse method to the Time built-in class. > > If you don't want to do that, you could roll your own by using > Time.local and parsing the string yourself and feeding the results to > Time.local. > > As far as finding the difference between two times, you can use the "-" > instance method to find the difference in seconds. If you need that in > hours or minutes, just have your script do the math. > > Definitely more work, but if you are looking for more speed than > DateTime, it might be worth it. > > Jamey > > --=-m7AGCX8b8y0ewkWeBkvX--