class TZInfo::Timestamp

def for_time(time, ignore_offset, target_utc_offset)

Experimental RBS support (using type sampling data from the type_fusion project).

def for_time: (Time time, bool ignore_offset, Symbol? target_utc_offset) -> TZInfo::Timestamp

This signature was generated using 86 samples from 5 applications.

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

Parameters:
  • target_utc_offset (Object) -- if `ignore_offset` is `true`, the UTC
  • ignore_offset (Boolean) -- whether to ignore the offset of `time`.
  • time (Time) -- a `Time`.
def for_time(time, ignore_offset, target_utc_offset)
  value = time.to_i
  sub_second = time.subsec
  if ignore_offset
    utc_offset = target_utc_offset
    value += time.utc_offset
  elsif time.utc?
    utc_offset = :utc
  else
    utc_offset = time.utc_offset
  end
  new!(value, sub_second, utc_offset)
end