14 lines
335 B
Python
14 lines
335 B
Python
from datetime import timedelta
|
|
|
|
from math import floor
|
|
|
|
|
|
def hours_to_hours_and_minutes(time: timedelta) -> tuple[int, int]:
|
|
if time.total_seconds() < 60:
|
|
return 0, 0
|
|
|
|
hours = time.total_seconds() / 3600
|
|
res_hours = int(floor(hours))
|
|
minutes = int(floor((hours - res_hours) * 60))
|
|
return res_hours, minutes
|