module T

Attributes

utc_offset[R]

UTC offset in seconds to apply time instances before displaying. If not set, time instances are displayed in default local time.

Public Class Methods

local_time(time) click to toggle source

Convert time to local time by applying the `utc_offset` setting.

# File lib/t.rb, line 7
def local_time(time)
  time = time.dup
  utc_offset ? (time.utc + utc_offset) : time.localtime
end
utc_offset=(offset) click to toggle source
# File lib/t.rb, line 16
def utc_offset=(offset)
  @utc_offset = case offset
  when String
    Time.zone_offset(offset)
  when NilClass
    nil
  else
    offset.to_i
  end
end