What would be an elegant, efficient and Pythonic way to perform a h/m/s rounding operation on time related types in Python with control over the rounding resolution?
My guess is that it would require a time modulo operation. Illustrative examples:
- 20:11:13 % (10 seconds) => (3 seconds)
- 20:11:13 % (10 minutes) => (1 minutes and 13 seconds)
Relevant time related types I can think of:
datetime.datetime
\datetime.time
struct_time