Sha256: e993913d97b59db3575a6d96fc8aead83c4747887c1cf1f9dac3b180a99a5610
Contents?: true
Size: 725 Bytes
Versions: 1
Compression:
Stored size: 725 Bytes
Contents
class EorzeaTime def self.now from_time Time.now end def self.from_time(t) new(t.to_f * 1440 / 70) # ET 1440m (24h) in LT is 70m end def initialize(i) @epoch = i % 86400 @time = Time.at(@epoch).utc end def to_i @epoch end def +(o) self.class.new @epoch + o end def -(o) self.class.new @epoch - o end def hour @time.hour end def min @time.min end def sec @time.sec end def usec @time.usec end def inspect "#<EorzeaTime #{to_s}>" end def to_s "%02d:%02d:%02d" % [hour, min, sec] end def to_h { i: @epoch, hour: hour, min: min, sec: sec, } end end require "eorzea_time/version"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eorzea_time-0.1.0 | lib/eorzea_time.rb |