From: Peter Vandenabeele Date: 2012-01-22T06:41:07+09:00 Subject: Re: Parsing log with date time entry --00235429e27c5e677f04b710a759 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Jan 21, 2012 at 9:52 PM, Kenichi Kamiya wrote: > Hi > > Is this log fomart below meanings? > mon/day/year hour:min:sec:millisec > And Time.parse is not better this case, I guess. > And Christopher want to millisec? then you use padding 0 or cast to Time > > # a sample of "cast to Time" with Peter's test case(+) > http://ideone.com/tBz7D > > Thank you for the correction. Indeed, because of the variable width on the milliseconds (1 to 3 digits), you can have 12/31/2011 23:45:30:2 seemingly later than 12/31/2011 23:45:30:10 > # Note > "%L" in Time#strftime means 'microsec', I did't know this too. > I believe that is not correct. It seems to be "milliseconds". from http://ruby-doc.org/core-1.9.3/Time.html the section "strftime( string ) =E2=86=92 string" %L - Millisecond of the second (000..999) %N - Fractional seconds digits, default is 9 digits (nanosecond) %3N millisecond (3 digits) %6N microsecond (6 digits) %9N nanosecond (9 digits) %12N picosecond (12 digits) HTH, Peter --=20 Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com --00235429e27c5e677f04b710a759--