@@ -527,7 +527,7 @@ def tearDown(self) -> None:
527527
528528 @parameterized .expand (type_pairs , name_func = expand_params )
529529 def test_types (self , source_db , target_db , source_type , target_type , type_category ):
530- start = time .time ()
530+ start = time .monotonic ()
531531
532532 self .src_conn = src_conn = CONNS [source_db ]
533533 self .dst_conn = dst_conn = CONNS [target_db ]
@@ -550,12 +550,12 @@ def test_types(self, source_db, target_db, source_type, target_type, type_catego
550550 self .src_table = src_table = "." .join (map (src_conn .quote , src_table_path ))
551551 self .dst_table = dst_table = "." .join (map (dst_conn .quote , dst_table_path ))
552552
553- start = time .time ()
553+ start = time .monotonic ()
554554 if not BENCHMARK :
555555 _drop_table_if_exists (src_conn , src_table )
556556 _create_table_with_indexes (src_conn , src_table , source_type )
557557 _insert_to_table (src_conn , src_table , enumerate (sample_values , 1 ), source_type )
558- insertion_source_duration = time .time () - start
558+ insertion_source_duration = time .monotonic () - start
559559
560560 values_in_source = PaginatedTable (src_table , src_conn )
561561 if source_db is db .Presto or source_db is db .Trino :
@@ -564,12 +564,12 @@ def test_types(self, source_db, target_db, source_type, target_type, type_catego
564564 elif source_type .startswith ("timestamp" ):
565565 values_in_source = ((a , datetime .fromisoformat (b .rstrip (" UTC" ))) for a , b in values_in_source )
566566
567- start = time .time ()
567+ start = time .monotonic ()
568568 if not BENCHMARK :
569569 _drop_table_if_exists (dst_conn , dst_table )
570570 _create_table_with_indexes (dst_conn , dst_table , target_type )
571571 _insert_to_table (dst_conn , dst_table , values_in_source , target_type )
572- insertion_target_duration = time .time () - start
572+ insertion_target_duration = time .monotonic () - start
573573
574574 if type_category == "uuid" :
575575 self .table = TableSegment (self .src_conn , src_table_path , "col" , None , ("id" ,), case_sensitive = False )
@@ -578,13 +578,13 @@ def test_types(self, source_db, target_db, source_type, target_type, type_catego
578578 self .table = TableSegment (self .src_conn , src_table_path , "id" , None , ("col" ,), case_sensitive = False )
579579 self .table2 = TableSegment (self .dst_conn , dst_table_path , "id" , None , ("col" ,), case_sensitive = False )
580580
581- start = time .time ()
581+ start = time .monotonic ()
582582 self .assertEqual (N_SAMPLES , self .table .count ())
583- count_source_duration = time .time () - start
583+ count_source_duration = time .monotonic () - start
584584
585- start = time .time ()
585+ start = time .monotonic ()
586586 self .assertEqual (N_SAMPLES , self .table2 .count ())
587- count_target_duration = time .time () - start
587+ count_target_duration = time .monotonic () - start
588588
589589 # When testing, we configure these to their lowest possible values for
590590 # the DEFAULT_N_SAMPLES.
@@ -598,9 +598,9 @@ def test_types(self, source_db, target_db, source_type, target_type, type_catego
598598 bisection_factor = ch_factor ,
599599 max_threadpool_size = ch_threads ,
600600 )
601- start = time .time ()
601+ start = time .monotonic ()
602602 diff = list (differ .diff_tables (self .table , self .table2 ))
603- checksum_duration = time .time () - start
603+ checksum_duration = time .monotonic () - start
604604 expected = []
605605 self .assertEqual (expected , diff )
606606 self .assertEqual (0 , differ .stats .get ("rows_downloaded" , 0 ))
@@ -617,9 +617,9 @@ def test_types(self, source_db, target_db, source_type, target_type, type_catego
617617 differ = TableDiffer (
618618 bisection_threshold = dl_threshold , bisection_factor = dl_factor , max_threadpool_size = dl_threads
619619 )
620- start = time .time ()
620+ start = time .monotonic ()
621621 diff = list (differ .diff_tables (self .table , self .table2 ))
622- download_duration = time .time () - start
622+ download_duration = time .monotonic () - start
623623 expected = []
624624 self .assertEqual (expected , diff )
625625 self .assertEqual (len (sample_values ), differ .stats .get ("rows_downloaded" , 0 ))
0 commit comments