class Time

Invoca ::Time extensions

Public Instance Methods

beginning_of_hour() click to toggle source
# File lib/invoca/utils/time.rb, line 25
def beginning_of_hour
  change(:min => 0, :sec => 0, :usec => 0)
end
end_of_day_whole_sec() click to toggle source
# File lib/invoca/utils/time.rb, line 29
def end_of_day_whole_sec # usec can be bad because it isn't preserved by MySQL
  change(:hour => 23, :min => 59, :sec => 59, :usec => 0)
end
ms_for_3339() click to toggle source
# File lib/invoca/utils/time.rb, line 15
def ms_for_3339
  @ms_for_3339 ||= ("%03.3d" % (self.to_ms % 1000))
end
rfc3339ms() click to toggle source
# File lib/invoca/utils/time.rb, line 11
def rfc3339ms
  strftime("%Y-%m-%dT%H:%M:%S.#{ms_for_3339}%z")
end
to_ms() click to toggle source
# File lib/invoca/utils/time.rb, line 5
def to_ms
  @to_ms ||= (self.to_f * 1000).to_i
end
whole_sec() click to toggle source
# File lib/invoca/utils/time.rb, line 33
def whole_sec
  change(:usec => 0)
end