MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / farthest

Method farthest

src/pendulum/time.py:77–87  ·  view source on GitHub ↗

Get the farthest time from the instance.

(self, dt1: Time | time, dt2: Time | time)

Source from the content-addressed store, hash-verified

75 return dt2
76
77 def farthest(self, dt1: Time | time, dt2: Time | time) -> Self:
78 """
79 Get the farthest time from the instance.
80 """
81 dt1 = self.__class__(dt1.hour, dt1.minute, dt1.second, dt1.microsecond)
82 dt2 = self.__class__(dt2.hour, dt2.minute, dt2.second, dt2.microsecond)
83
84 if self.diff(dt1).in_seconds() > self.diff(dt2).in_seconds():
85 return dt1
86
87 return dt2
88
89 # ADDITIONS AND SUBSTRACTIONS
90

Callers 6

test_farthestFunction · 0.45
test_farthestFunction · 0.45
test_farthest_with_timeFunction · 0.45

Calls 2

diffMethod · 0.95
in_secondsMethod · 0.80

Tested by 6

test_farthestFunction · 0.36
test_farthestFunction · 0.36
test_farthest_with_timeFunction · 0.36