Method: Logging::Layout#apply_utc_offset

Defined in:
lib/logging/layout.rb

#apply_utc_offset(time) ⇒ Object

Internal: Helper method that applies the UTC offset to the given time instance. A new Time is returned that is equivalent to the original time but pinned to the timezone given by the UTC offset.

If a UTC offset has not been set, then the original time instance is returned unchanged.



114
115
116
117
118
119
120
121
122
123
124
# File 'lib/logging/layout.rb', line 114

def apply_utc_offset( time )
  return time if utc_offset.nil?

  time = time.dup
  if utc_offset == 0
    time.utc
  else
    time.localtime(utc_offset)
  end
  time
end