class Oletime::Time
Holds `time` value and converts to and from ole float value
Attributes
time[RW]
Public Class Methods
from_ole(value)
click to toggle source
# File lib/oletime.rb, line 16 def self.from_ole(value) new(::Time.now.year).tap do |t| t.time = ::Time.at((value - 25_569) * 86_400).utc end end
new(year = nil, month = nil, day = nil, hour = nil, minute = nil, second = nil, utc_offset = nil)
click to toggle source
# File lib/oletime.rb, line 7 def initialize(year = nil, month = nil, day = nil, hour = nil, minute = nil, second = nil, utc_offset = nil) if year @time = ::Time.new(year, month, day, hour, minute, second, utc_offset) else @time = ::Time.new.utc end end
Public Instance Methods
to_ole()
click to toggle source
# File lib/oletime.rb, line 22 def to_ole (@time.to_f / 86_400) + 25_569 end
to_s()
click to toggle source
# File lib/oletime.rb, line 26 def to_s @time.to_s end