Class: RASN1::Types::GeneralizedTime

Inherits:
Primitive show all
Defined in:
lib/rasn1/types/generalized_time.rb

Overview

ASN.1 GeneralizedTime

+Base#value of a GeneralizedTime should be a ruby Time.

Notes

When encoding, resulting string is always a UTC time, appended with Z. Minutes and seconds are always generated. Fractions of second are generated if value Time object have them.

On parsing, are supported:

  • UTC times (ending with Z),

  • local times (no suffix),

  • local times with difference between UTC and this local time (ending with sHHMM, where s is +++ or -, and HHMM is the time differential betwen UTC and local time).

These times may include minutes and seconds. Fractions of hour, minute and second are supported.

Author:

  • Sylvain Daubert

Constant Summary collapse

ID =

GeneralizedTime id value

24
HOUR_TO_SEC =
3600
MINUTE_TO_SEC =
60
SECOND_TO_SEC =
1

Constants inherited from Primitive

Primitive::ASN1_PC

Constants inherited from Base

Base::CLASSES, Base::CLASS_MASK, Base::INDEFINITE_LENGTH, Base::MULTI_OCTETS_ID

Instance Attribute Summary

Attributes inherited from Base

#asn1_class, #default, #name, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #can_build?, constrained?, #constructed?, #do_parse_explicit_with_tracing, #do_parse_with_tracing, encoded_type, #explicit?, #id, #implicit?, #initialize, #initialize_copy, #inspect, #optional?, parse, #parse!, #primitive?, #specific_initializer, start_tracing, stop_tracing, #tagged?, #to_der, #trace, #type, #value, #value=, #value?, #value_size

Constructor Details

This class inherits a constructor from RASN1::Types::Base

Class Method Details

.typeString

Get ASN.1 type

Returns:

  • (String)


38
39
40
# File 'lib/rasn1/types/generalized_time.rb', line 38

def self.type
  'GeneralizedTime'
end

Instance Method Details

#void_valueTime

Returns:

  • (Time)


43
44
45
# File 'lib/rasn1/types/generalized_time.rb', line 43

def void_value
  Time.now
end