Module: Samlr::Tools::Timestamp

Defined in:
lib/samlr/tools/timestamp.rb

Class Method Summary collapse

Class Method Details

.not_before?(time) ⇒ Boolean

True when the current time is not before the given time

Returns:

  • (Boolean)


20
21
22
# File 'lib/samlr/tools/timestamp.rb', line 20

def self.not_before?(time)
  Time.now.to_i >= (time.to_i - Samlr.jitter.to_i)
end

.not_on_or_after?(time) ⇒ Boolean

Is the current time on or after the given time?

Returns:

  • (Boolean)


15
16
17
# File 'lib/samlr/tools/timestamp.rb', line 15

def self.not_on_or_after?(time)
  Time.now.to_i <= (time.to_i + Samlr.jitter.to_i)
end

.parse(value) ⇒ Object



10
11
12
# File 'lib/samlr/tools/timestamp.rb', line 10

def self.parse(value)
  Time.iso8601(value)
end

.stamp(time = Time.now) ⇒ Object

Generate a current timestamp in ISO8601 format



6
7
8
# File 'lib/samlr/tools/timestamp.rb', line 6

def self.stamp(time = Time.now)
  time.utc.iso8601
end