Method: Indy::Source#time_at
- Defined in:
- lib/indy/source.rb
#time_at(index, delta = 0) ⇒ Object
Return the time of a log entry index, with an optional offset
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/indy/source.rb', line 160 def time_at(index, delta=0) begin entry = @entries[index + delta] time = @log_definition.parse_entry(entry)[:time] result = Indy::Time.parse_date(time, @log_definition.time_format) rescue FieldMismatchException => fme raise rescue Exception => e msg = "Unable to parse time from entry. Time value was #{time.inspect}. Original exception was:\n#{e.class}\n" raise Indy::Time::ParseException, msg + e. end if result.nil? raise Indy::Time::ParseException, "Unable to parse datetime. Raw value was #{time.inspect}. Entry was #{entry}." end result end |