From 1e05f438d7c952300b646372d6f894da96358e8c Mon Sep 17 00:00:00 2001 From: besendorf Date: Fri, 9 Oct 2026 03:48:37 -0700 Subject: [PATCH] Include the eighth prior year when resolving settings leap days Adjust the year range for leap year calculation to account for century years. --- src/mvt/android/artifacts/settings.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mvt/android/artifacts/settings.py b/src/mvt/android/artifacts/settings.py index 8237ee34..91b357d6 100644 --- a/src/mvt/android/artifacts/settings.py +++ b/src/mvt/android/artifacts/settings.py @@ -257,13 +257,14 @@ class Settings(AndroidArtifact): at or before that time. The year is parsed together with the value, because strptime() would - otherwise parse it in 1900, which has no 29 February. Going back eight - years always reaches a leap year. + otherwise parse it in 1900, which has no 29 February. The most recent + matching leap day can be eight years earlier when a century year is + not a leap year and the current year's leap day is still in the future. """ if section_end is None: return None - for year in range(section_end.year, section_end.year - 8, -1): + for year in range(section_end.year, section_end.year - 9, -1): try: timestamp = datetime.strptime(f"{year}-{value}", "%Y-%m-%d %H:%M:%S.%f") except ValueError: