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
Instance Method Summary collapse
-
#call(value, packet, buffer) ⇒ Float
Packet time in seconds since UNIX epoch.
-
#initialize(seconds_item_name, microseconds_item_name = nil) ⇒ 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) ⇒ UnixTimeSecondsConversion
Initializes converted_type to :FLOAT and converted_bit_size to 64
35 36 37 38 39 |
# File 'lib/openc3/conversions/unix_time_seconds_conversion.rb', line 35 def initialize(seconds_item_name, microseconds_item_name = nil) super(seconds_item_name, microseconds_item_name) @converted_type = :FLOAT @converted_bit_size = 64 end |
Instance Method Details
#call(value, packet, buffer) ⇒ Float
Returns Packet time in seconds since UNIX epoch.
43 44 45 |
# File 'lib/openc3/conversions/unix_time_seconds_conversion.rb', line 43 def call(value, packet, buffer) super.to_f end |
#to_s ⇒ String
Returns The name of the class followed by the time conversion.
48 49 50 |
# File 'lib/openc3/conversions/unix_time_seconds_conversion.rb', line 48 def to_s super << ".to_f" end |