Module: BerkeleyLibrary::Util::Times
Instance Method Summary collapse
-
#ensure_utc(time) ⇒ Object
The UTC time corresponding to
time.
Instance Method Details
#ensure_utc(time) ⇒ Object
Returns the UTC time corresponding to time.
12 13 14 15 16 17 18 19 |
# File 'lib/berkeley_library/util/times.rb', line 12 def ensure_utc(time) return unless time return time if time.respond_to?(:utc?) && time.utc? return time.getutc if time.respond_to?(:getutc) return time.to_time.getutc if time.respond_to?(:to_time) raise ArgumentError, "Not a date or time: #{time.inspect}" end |