Sha256: 203e013d413b2a187420544b219157e82a7ba54d897df96ebb6a654ddbb0e486
Contents?: true
Size: 429 Bytes
Versions: 2
Compression:
Stored size: 429 Bytes
Contents
# 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" def to_s_for_cap 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rcap-2.7.4 | lib/rcap/extensions/time.rb |
rcap-2.7.3 | lib/rcap/extensions/time.rb |