Measure install time with monotonic clock instead of system clock (#4198)

Using time.time() can be inaccurate if the system clock gets
updated in between calls.
This commit is contained in:
correctmost 2026-02-01 06:48:09 -05:00 committed by GitHub
parent 173c64c847
commit 331634fd80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ def perform_installation(
Only requirement is that the block devices are Only requirement is that the block devices are
formatted and setup prior to entering this function. formatted and setup prior to entering this function.
""" """
start_time = time.time() start_time = time.monotonic()
info('Starting installation...') info('Starting installation...')
config = arch_config_handler.config config = arch_config_handler.config
@ -169,7 +169,7 @@ def perform_installation(
debug(f'Disk states after installing:\n{disk_layouts()}') debug(f'Disk states after installing:\n{disk_layouts()}')
if not arch_config_handler.args.silent: if not arch_config_handler.args.silent:
elapsed_time = time.time() - start_time elapsed_time = time.monotonic() - start_time
action = select_post_installation(elapsed_time) action = select_post_installation(elapsed_time)
match action: match action: