Class: OpenC3::UnixTimeSecondsConversion
- Inherits:
-
UnixTimeConversion
- Object
- Conversion
- UnixTimeConversion
- OpenC3::UnixTimeSecondsConversion
- Defined in:
- lib/openc3/conversions/unix_time_seconds_conversion.rb
Overview
Converts a unix format time: Epoch Jan 1 1970, seconds and microseconds, into a floating point number.
Instance Attribute Summary
Attributes inherited from Conversion
#converted_array_size, #converted_bit_size, #converted_type, #params
Instance Method Summary collapse
-
#call(value, packet, buffer) ⇒ Float
Packet time in seconds since UNIX epoch.
-
#initialize(seconds_item_name, microseconds_item_name = nil, seconds_type = 'RAW', microseconds_type = 'RAW') ⇒ UnixTimeSecondsConversion
constructor
Initializes converted_type to :FLOAT and converted_bit_size to 64.
-
#to_s ⇒ String
The name of the class followed by the time conversion.
Methods inherited from UnixTimeConversion
Methods inherited from Conversion
Constructor Details
#initialize(seconds_item_name, microseconds_item_name = nil, seconds_type = 'RAW', microseconds_type = 'RAW') ⇒ UnixTimeSecondsConversion
Initializes converted_type to :FLOAT and converted_bit_size to 64
35 36 37 38 39 40 |
# File 'lib/openc3/conversions/unix_time_seconds_conversion.rb', line 35 def initialize(seconds_item_name, microseconds_item_name = nil, seconds_type = 'RAW', microseconds_type = 'RAW') # @params is set by the parent class in super() super(seconds_item_name, microseconds_item_name, seconds_type, microseconds_type) @converted_type = :FLOAT @converted_bit_size = 64 end |
Instance Method Details
#call(value, packet, buffer) ⇒ Float
Returns Packet time in seconds since UNIX epoch.
44 45 46 |
# File 'lib/openc3/conversions/unix_time_seconds_conversion.rb', line 44 def call(value, packet, buffer) super.to_f end |
#to_s ⇒ String
Returns The name of the class followed by the time conversion.
49 50 51 |
# File 'lib/openc3/conversions/unix_time_seconds_conversion.rb', line 49 def to_s super << ".to_f" end |