Class: Grpc::ORiN3::Provider::DateTimeConverter
- Inherits:
-
Object
- Object
- Grpc::ORiN3::Provider::DateTimeConverter
- Defined in:
- lib/grpc/orin3/provider/date_time_converter.rb
Constant Summary collapse
- TICKS_PER_SECOND =
10_000_000
- EPOCH =
Time.utc(1, 1, 1, 0, 0, 0)
Class Method Summary collapse
Class Method Details
.from_int64(int64) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/grpc/orin3/provider/date_time_converter.rb', line 16 def self.from_int64(int64) filter = 0x3FFFFFFFFFFFFFFF datetime_num = int64 & filter seconds_since_windows_epoch = datetime_num.to_f / TICKS_PER_SECOND return EPOCH + seconds_since_windows_epoch end |
.to_int64(time) ⇒ Object
10 11 12 13 14 |
# File 'lib/grpc/orin3/provider/date_time_converter.rb', line 10 def self.to_int64(time) utc_time = time.utc ticks = ((utc_time - EPOCH) * TICKS_PER_SECOND).to_i return ticks & 0x3FFFFFFFFFFFFFFF end |