[SyncAnalysisState] Preserve synctime µs

By default, datetime.isoformat() uses different format depending on
microseconds - if is equal to 0, microseconds are omitted, but otherwise
not.

Setting timespec = 'microseconds' ensures the format is the same
regardless of current time.

Change-Id: Icb1be31eb681247c7e46923cdeabb8f5469c20f0
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/371694
Tested-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Joanna Wang <jojwang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This commit is contained in:
Josip Sokcevic 2023-04-27 10:45:04 -07:00 committed by LUCI
parent e7e20f4686
commit 7ef5b465cd

View File

@ -792,7 +792,7 @@ class SyncAnalysisState:
""" """
self._config = config self._config = config
now = datetime.datetime.utcnow() now = datetime.datetime.utcnow()
self._Set("main.synctime", now.isoformat() + "Z") self._Set("main.synctime", now.isoformat(timespec="microseconds") + "Z")
self._Set("main.version", "1") self._Set("main.version", "1")
self._Set("sys.argv", sys.argv) self._Set("sys.argv", sys.argv)
for key, value in superproject_logging_data.items(): for key, value in superproject_logging_data.items():