Class: Tai64::Time
Instance Method Summary collapse
-
#initialize(time) ⇒ Time
constructor
A new instance of Time.
- #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.
- #to_s ⇒ Object
- #utc_nanosecond ⇒ Object
- #utc_second ⇒ Object
Methods included from Fudge
Constructor Details
#initialize(time) ⇒ Time
Returns a new instance of Time.
37 38 39 |
# File 'lib/tai64.rb', line 37 def initialize time self.time = time end |
Instance Method Details
#tai_nanosecond ⇒ Object
53 54 55 |
# File 'lib/tai64.rb', line 53 def tai_nanosecond utc_nanosecond + nano_second_fudge end |
#tai_second ⇒ Object
45 46 47 |
# File 'lib/tai64.rb', line 45 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.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/tai64.rb', line 60 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 |
#to_s ⇒ Object
71 72 73 |
# File 'lib/tai64.rb', line 71 def to_s time.to_s end |
#utc_nanosecond ⇒ Object
49 50 51 |
# File 'lib/tai64.rb', line 49 def utc_nanosecond time.to_f - time.to_i end |
#utc_second ⇒ Object
41 42 43 |
# File 'lib/tai64.rb', line 41 def utc_second time.to_i end |