Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pendulum/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ def local_time(
month -= 1

# Handle hours, minutes, seconds and microseconds
hour = seconds // SECS_PER_HOUR
seconds %= SECS_PER_HOUR
minute = seconds // SECS_PER_MIN
second = seconds % SECS_PER_MIN
hour, seconds = divmod(seconds, SECS_PER_HOUR)
minute, second = divmod(seconds, SECS_PER_MIN)

return year, month, day, hour, minute, second, microseconds

Expand Down
7 changes: 2 additions & 5 deletions pendulum/duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,9 @@ def __new__(
total = abs(self._total)

self._microseconds = round(total % 1 * 1e6)
self._seconds = int(total) % SECONDS_PER_DAY

days = int(total) // SECONDS_PER_DAY
days, self._seconds = divmod(int(total), SECONDS_PER_DAY)
self._days = abs(days + years * 365 + months * 30)
self._remaining_days = days % 7
self._weeks = days // 7
self._weeks, self._remaining_days = divmod(days, 7)
self._months = abs(months)
self._years = abs(years)

Expand Down