BallAerospace / COSMOS

Ball Aerospace COSMOS
https://ballaerospace.github.io/cosmos-website/
Other
360 stars 127 forks source link

Real Time for CMD packets #726

Closed rampage24life closed 6 years ago

rampage24life commented 6 years ago

I need a timestamp within my CMD parameters and need it to appear in the Command History. Is there a code for that?

ghost commented 6 years ago

All commands in COSMOS are timestamped in the server_messages log like so:

2018/02/12 09:25:35.293  INFO: cmd("INST CLEAR")

If you want to put an actual time stamp in your command parameters you'll have to define it like anything else. CCSDS defines it like so:

  APPEND_ITEM TIMESEC      32 UINT   "Seconds since epoch (January 1st, 1970, midnight)"
  APPEND_ITEM TIMEUS       32 UINT   "Microseconds of second"

You can also write a conversion that could convert that to something more human readable like so:

  ITEM TIMESECONDS 0 0 DERIVED "Derived floating-point time since epoch in seconds"
    READ_CONVERSION unix_time_seconds_conversion.rb TIMESEC TIMEUS
    FORMAT_STRING '%0.6f'
  ITEM TIMEFORMATTED 0 0 DERIVED "Derived time since epoch as formatted string"
    READ_CONVERSION unix_time_formatted_conversion.rb TIMESEC TIMEUS

This is taken right from the demo as COSMOS provides these conversions for you. The source code location for conversions is here: https://github.com/BallAerospace/COSMOS/tree/master/lib/cosmos/conversions

You can derive from these conversions to create your own.