Synchronize access point system clock

Access points do not have access to the internet, so they are unable to
fetch from a NTP server to update their system clock. Set the system
clock of the access point to be the same as the host. Helps readability
of logs due to now being able to correlate test and AP logs.

Change-Id: I45ee95722ecb841c7492125edc946d351b0c08f4
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/1044799
Reviewed-by: Anthonio Saw <anthonio@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Sam Balana <sbalana@google.com>
diff --git a/packages/antlion/controllers/access_point.py b/packages/antlion/controllers/access_point.py
index d1656f5..6273937 100755
--- a/packages/antlion/controllers/access_point.py
+++ b/packages/antlion/controllers/access_point.py
@@ -14,6 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import datetime
 import ipaddress
 import time
 from dataclasses import dataclass
@@ -137,6 +138,10 @@
         self._initial_ap()
         self.setup_bridge = False
 
+        # Access points are not given internet access, so their system time needs to be
+        # manually set to be accurate.
+        self._sync_time()
+
     def _initial_ap(self) -> None:
         """Initial AP interfaces.
 
@@ -167,6 +172,15 @@
             self.ssh.run(BRIDGE_DOWN)
             self.ssh.run(BRIDGE_DEL)
 
+    def _sync_time(self) -> None:
+        """Synchronize the system time.
+
+        Allows for better synchronization between antlion host logs and AP logs.
+        Useful for when the device does not have internet connection.
+        """
+        now = datetime.datetime.now().astimezone().isoformat()
+        self.ssh.run(f'date -s "{now}"')
+
     def start_ap(
         self,
         hostapd_config: HostapdConfig,