Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/invoca/utils/time.rb
Overview
Invoca ::Time extensions
Instance Method Summary collapse
- #beginning_of_hour ⇒ Object
-
#end_of_day_whole_sec ⇒ Object
usec can be bad because it isn’t preserved by MySQL.
- #rfc3339ms ⇒ Object
- #to_ms ⇒ Object
- #whole_sec ⇒ Object
Instance Method Details
#beginning_of_hour ⇒ Object
25 26 27 |
# 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 ⇒ Object
usec can be bad because it isn’t preserved by MySQL
29 30 31 |
# 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 |
#rfc3339ms ⇒ Object
11 12 13 |
# File 'lib/invoca/utils/time.rb', line 11 def rfc3339ms strftime("%Y-%m-%dT%H:%M:%S.#{ms_for_3339}%z") end |
#to_ms ⇒ Object
5 6 7 |
# File 'lib/invoca/utils/time.rb', line 5 def to_ms @to_ms ||= (self.to_f * 1000).to_i end |
#whole_sec ⇒ Object
33 34 35 |
# File 'lib/invoca/utils/time.rb', line 33 def whole_sec change(:usec => 0) end |