Total Complexity | 1 |
Total Lines | 13 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from datetime import timedelta |
||
2 | |||
3 | |||
4 | def default_timedelta_serializer(obj: timedelta, **kwargs) -> float: |
||
5 | """ |
||
6 | Serialize the given timedelta instance to a float holding the total |
||
7 | seconds. |
||
8 | :param obj: the timedelta instance that is to be serialized. |
||
9 | :param kwargs: not used. |
||
10 | :return: ``timedelta`` as a float. |
||
11 | """ |
||
12 | return obj.total_seconds() |
||
13 |