Module: DateTimeParser

Included in:
Lap, Waypoint
Defined in:
lib/date_time_parser.rb

Instance Method Summary collapse

Instance Method Details

#read_date_time(data) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/date_time_parser.rb', line 2

def read_date_time(data)
  val = BinData::Uint64le.read(data)
  LOGGER.debug "val is #{val.inspect}"
  val -= 9223372036854775808 if val >= 9223372036854775808
  val -= 4611686018427387904 if val >= 4611686018427387904
  LOGGER.debug "after tweaks val is #{val.inspect}"
  val = (val - 621355968000000000) / 10000000.0
  LOGGER.debug "time was #{Time.at(val)}"
  val
end