Method: Time.ccsds2mdy
- Defined in:
- lib/openc3/core_ext/time.rb
.ccsds2mdy(day, ms, us) ⇒ Array<Year, Month, Day, Hour, Minute, Second, Microsecond>
Convert a CCSDS Date to mdy format Note that an array is returned rather than a Time object because Time objects cannot represent all possible CCSDS dates
348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/openc3/core_ext/time.rb', line 348 def self.ccsds2mdy(day, ms, us) jdate = day + JULIAN_DATE_OF_CCSDS_EPOCH year, month, day, hour, minute, second, _ = julian2mdy(jdate) hour = (ms / MSEC_PER_HOUR).to_i temp = ms - (hour * MSEC_PER_HOUR) minute = (temp / MSEC_PER_MINUTE).to_i temp -= minute * MSEC_PER_MINUTE second = temp / MSEC_PER_SECOND temp -= second * MSEC_PER_SECOND us = us + (temp * USEC_PER_MSEC) return [year, month, day, hour, minute, second, us] end |