lib/rcap/extensions/time.rb in rcap-2.7.0 vs lib/rcap/extensions/time.rb in rcap-2.7.3
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class Time
# Returns a string representaion of the time suitable for CAP.
# @return [String]
# @example
# Time.now.to_s_for_cap # => "2011-10-26T21:45:00+02:00"
@@ -7,9 +9,10 @@
t = strftime(RCAP::RCAP_TIME_FORMAT) + format(RCAP::RCAP_ZONE_FORMAT, utc_hours_offset)
t.sub(/\+(00:\d\d)$/, '-\1')
end
private
+
def utc_hours_offset
localtime.utc_offset / 3600
end
end