Class: OpenC3::PacketTimeSecondsConversion
- Inherits:
-
Conversion
- Object
- Conversion
- OpenC3::PacketTimeSecondsConversion
- Defined in:
- lib/openc3/conversions/packet_time_seconds_conversion.rb
Overview
Converts the packet received time into floating point seconds.
Instance Attribute Summary
Attributes inherited from Conversion
#converted_array_size, #converted_bit_size, #converted_type
Instance Method Summary collapse
-
#call(value, packet, buffer) ⇒ Float
Packet received time in seconds.
-
#initialize ⇒ PacketTimeSecondsConversion
constructor
Initializes converted_type to :FLOAT and converted_bit_size to 64.
Methods inherited from Conversion
Constructor Details
#initialize ⇒ PacketTimeSecondsConversion
Initializes converted_type to :FLOAT and converted_bit_size to 64
29 30 31 32 33 |
# File 'lib/openc3/conversions/packet_time_seconds_conversion.rb', line 29 def initialize super() @converted_type = :FLOAT @converted_bit_size = 64 end |
Instance Method Details
#call(value, packet, buffer) ⇒ Float
Returns Packet received time in seconds.
37 38 39 40 41 42 43 44 |
# File 'lib/openc3/conversions/packet_time_seconds_conversion.rb', line 37 def call(value, packet, buffer) packet_time = packet.packet_time if packet_time return packet_time.to_f else return 0.0 end end |