Class: BeltsEngine::Tools::Time
- Inherits:
-
Object
- Object
- BeltsEngine::Tools::Time
- Defined in:
- lib/belts_engine/tools/time.rb
Instance Attribute Summary collapse
-
#delta_time ⇒ Object
readonly
Returns the value of attribute delta_time.
-
#uptime ⇒ Object
readonly
Returns the value of attribute uptime.
Instance Method Summary collapse
-
#initialize ⇒ Time
constructor
A new instance of Time.
- #update ⇒ Object
Constructor Details
#initialize ⇒ Time
Returns a new instance of Time.
6 7 8 9 10 11 |
# File 'lib/belts_engine/tools/time.rb', line 6 def initialize @start_time = system_time @last_time = @start_time @uptime = 0 @delta_time = 0 end |
Instance Attribute Details
#delta_time ⇒ Object (readonly)
Returns the value of attribute delta_time.
4 5 6 |
# File 'lib/belts_engine/tools/time.rb', line 4 def delta_time @delta_time end |
#uptime ⇒ Object (readonly)
Returns the value of attribute uptime.
4 5 6 |
# File 'lib/belts_engine/tools/time.rb', line 4 def uptime @uptime end |
Instance Method Details
#update ⇒ Object
13 14 15 16 17 |
# File 'lib/belts_engine/tools/time.rb', line 13 def update @delta_time = system_time - @last_time @last_time = system_time @uptime += @delta_time end |