Class: Tai64::Time
Instance Method Summary collapse
-
#initialize(time) ⇒ Time
constructor
A new instance of Time.
- #iso8601 ⇒ Object (also: #to_s)
- #tai_nanosecond ⇒ Object
- #tai_second ⇒ Object
-
#to_label ⇒ Object
Warning, this will probably gain inappropriate accuracy - Ruby does not support the same level of timing accuracy as TAI64N and TA64NA can provide.
- #utc_nanosecond ⇒ Object
- #utc_second ⇒ Object
Methods included from Fudge
Constructor Details
#initialize(time) ⇒ Time
Returns a new instance of Time.
38 39 40 |
# File 'lib/tai64.rb', line 38 def initialize time self.time = time end |
Instance Method Details
#iso8601 ⇒ Object Also known as: to_s
72 73 74 |
# File 'lib/tai64.rb', line 72 def iso8601 time.iso8601 end |
#tai_nanosecond ⇒ Object
54 55 56 |
# File 'lib/tai64.rb', line 54 def tai_nanosecond utc_nanosecond + nano_second_fudge end |
#tai_second ⇒ Object
46 47 48 |
# File 'lib/tai64.rb', line 46 def tai_second utc_second + 10 end |
#to_label ⇒ Object
Warning, this will probably gain inappropriate accuracy - Ruby does not support the same level of timing accuracy as TAI64N and TA64NA can provide.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/tai64.rb', line 61 def to_label s = '%016x%08x' sec = tai_second ts = if sec >= 0 sec + EPOCH else EPOCH - sec end Label.new s % [ ts, tai_nanosecond ] end |
#utc_nanosecond ⇒ Object
50 51 52 |
# File 'lib/tai64.rb', line 50 def utc_nanosecond time.to_f - time.to_i end |
#utc_second ⇒ Object
42 43 44 |
# File 'lib/tai64.rb', line 42 def utc_second time.to_i end |