Calculate the absolute time difference between two timestamps in seconds. Args: t1: First timestamp string t2: Second timestamp string Returns: Absolute time difference in seconds as an integer
(t1: str, t2: str)
| 51 | |
| 52 | |
| 53 | def calculate_time_delta(t1: str, t2: str) -> int: |
| 54 | """ |
| 55 | Calculate the absolute time difference between two timestamps in seconds. |
| 56 | |
| 57 | Args: |
| 58 | t1: First timestamp string |
| 59 | t2: Second timestamp string |
| 60 | |
| 61 | Returns: |
| 62 | Absolute time difference in seconds as an integer |
| 63 | """ |
| 64 | # Parse both timestamps |
| 65 | dt1 = parse_timestamp(t1) |
| 66 | dt2 = parse_timestamp(t2) |
| 67 | |
| 68 | # Calculate absolute difference and convert to seconds |
| 69 | time_difference = abs(dt1 - dt2) |
| 70 | return int(time_difference.total_seconds()) |
| 71 | |
| 72 | |
| 73 | def read_test_cases() -> Tuple[int, List[Tuple[str, str]]]: |
no test coverage detected