class TungstenEngine::Core::TimeSpan
Represents the span between two points in time
Attributes
milliseconds[RW]
Public Class Methods
diff(start_date_time, end_date_time)
click to toggle source
# File lib/core/time_span.rb, line 37 def self.diff(start_date_time, end_date_time) TimeSpan.from_seconds(end_date_time - start_date_time) end
from_days(days)
click to toggle source
# File lib/core/time_span.rb, line 29 def self.from_days(days) TimeSpan.from_milliseconds(days * 86400000) end
from_hours(hours)
click to toggle source
# File lib/core/time_span.rb, line 25 def self.from_hours(hours) TimeSpan.from_milliseconds(hours * 3600000) end
from_microseconds(microseconds)
click to toggle source
# File lib/core/time_span.rb, line 7 def self.from_microseconds(microseconds) TimeSpan.from_milliseconds(microseconds / 1000.0) end
from_milliseconds(milliseconds)
click to toggle source
# File lib/core/time_span.rb, line 11 def self.from_milliseconds(milliseconds) me = TimeSpan.new me.milliseconds = milliseconds return me end
from_minutes(minutes)
click to toggle source
# File lib/core/time_span.rb, line 21 def self.from_minutes(minutes) TimeSpan.from_milliseconds(minutes * 60000) end
from_seconds(seconds)
click to toggle source
# File lib/core/time_span.rb, line 17 def self.from_seconds(seconds) TimeSpan.from_milliseconds(seconds * 1000) end
from_years(years)
click to toggle source
# File lib/core/time_span.rb, line 33 def self.from_years(years) TimeSpan.from_days(years * 365.242) end
Public Instance Methods
days()
click to toggle source
# File lib/core/time_span.rb, line 57 def days hours * 0.0416667 end
hours()
click to toggle source
# File lib/core/time_span.rb, line 53 def hours minutes * 0.0166667 end
microseconds()
click to toggle source
# File lib/core/time_span.rb, line 41 def microseconds milliseconds * 1000 end
minutes()
click to toggle source
# File lib/core/time_span.rb, line 49 def minutes seconds * 0.0166667 end
seconds()
click to toggle source
# File lib/core/time_span.rb, line 45 def seconds milliseconds * 0.001 end
years()
click to toggle source
# File lib/core/time_span.rb, line 61 def years days * 0.00273791 end