Class: Sb::Clock::Time
- Inherits:
-
Time
- Object
- Time
- Sb::Clock::Time
- Defined in:
- lib/sb/clock/time.rb
Constant Summary collapse
- @@set_time =
.to_i
::Time.now
- @@last_set =
.to_i
::Time.now
- @@sm =
1
Class Method Summary collapse
Class Method Details
.now ⇒ Object
19 20 21 22 23 24 |
# File 'lib/sb/clock/time.rb', line 19 def self.now n = ::Time.now#.to_i #.getlocal(@@gmt_offset) # speed_multiplier*(now - last_set)#t_diff + set_time at( @@sm*(n.to_i - @@last_set.to_i) + @@set_time.to_i ).getlocal(@@set_time.utc_offset) end |
.set(time) ⇒ Object
13 14 15 16 17 |
# File 'lib/sb/clock/time.rb', line 13 def self.set time #@@gmt_offset = time.getlocal.gmt_offset @@last_set = ::Time.now#.to_i #.getlocal(@@gmt_offset) @@set_time = time#.to_i end |
.set_speed(sm) ⇒ Object
8 9 10 11 |
# File 'lib/sb/clock/time.rb', line 8 def self.set_speed sm @@last_set = ::Time.now#.to_i @@sm = sm end |