class TZInfo::Timestamp

def for_time_like(time_like, ignore_offset, target_utc_offset)

Returns:
  • (Timestamp) - the {Timestamp} representation of `time_like`.

Parameters:
  • target_utc_offset (Object) -- if `ignore_offset` is `true`, the UTC
  • ignore_offset (Boolean) -- whether to ignore the offset of `time`.
  • time_like (Object) -- a `Time`-like object.
def for_time_like(time_like, ignore_offset, target_utc_offset)
  value = time_like.to_i
  sub_second = time_like.subsec.to_r
  if ignore_offset
    utc_offset = target_utc_offset
    value += time_like.utc_offset.to_i if time_like.respond_to?(:utc_offset)
  elsif time_like.respond_to?(:utc_offset)
    utc_offset = time_like.utc_offset.to_i
  else
    utc_offset = 0
  end
  new(value, sub_second, utc_offset)
end