Module: Samlr::Tools::Timestamp
- Defined in:
- lib/samlr/tools/timestamp.rb
Class Method Summary collapse
-
.not_before?(time) ⇒ Boolean
True when the current time is not before the given time.
-
.not_on_or_after?(time) ⇒ Boolean
Is the current time on or after the given time?.
- .parse(value) ⇒ Object
-
.stamp(time = Time.now) ⇒ Object
Generate a current timestamp in ISO8601 format.
Class Method Details
.not_before?(time) ⇒ Boolean
True when the current time is not before the given time
19 20 21 |
# File 'lib/samlr/tools/timestamp.rb', line 19 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?
14 15 16 |
# File 'lib/samlr/tools/timestamp.rb', line 14 def self.not_on_or_after?(time) Time.now.to_i <= (time.to_i + Samlr.jitter.to_i) end |
.parse(value) ⇒ Object
9 10 11 |
# File 'lib/samlr/tools/timestamp.rb', line 9 def self.parse(value) Time.iso8601(value) end |
.stamp(time = Time.now) ⇒ Object
Generate a current timestamp in ISO8601 format
5 6 7 |
# File 'lib/samlr/tools/timestamp.rb', line 5 def self.stamp(time = Time.now) time.utc.iso8601 end |