Skip to content

Commit

Permalink
verify_timedrift_corrected: Leap year
Browse files Browse the repository at this point in the history
Creating a time stamp with year `current_year - 2` will fail on Feb 29 because there is no Feb 29 for two years ago. This test case only requires the time difference to be significantly larger than 5 minutes.
  • Loading branch information
kamalca authored and LiliDeng committed Mar 4, 2024
1 parent 4e8ed16 commit e8286d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion microsoft/testsuites/core/timesync.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time
from copy import deepcopy
from datetime import timedelta
from pathlib import PurePosixPath
from time import sleep
from typing import List, Optional, Union, cast
Expand Down Expand Up @@ -418,7 +419,7 @@ def verify_timedrift_corrected(self, node: Node, log: Logger) -> None:
date = node.tools[Date]
node_time = date.current()
modified_time = deepcopy(node_time)
modified_time = modified_time.replace(year=node_time.year - 2)
modified_time = modified_time - timedelta(days=2)
date.set(modified_time)

# Poll every second and check if the time drift is corrected
Expand Down

0 comments on commit e8286d4

Please sign in to comment.