2525
2626#include "Python.h"
2727#include "frameobject.h" /* for PyFrame_ClearFreeList */
28- #include "pytime.h" /* for _PyTime_monotonic, _PyTime_INTERVAL */
28+ #include "pytime.h" /* for _PyTime_GetMonotonicClock() */
2929
3030/* Get an object's GC head */
3131#define AS_GC (o ) ((PyGC_Head *)(o)-1)
@@ -908,7 +908,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable,
908908 PyGC_Head unreachable ; /* non-problematic unreachable trash */
909909 PyGC_Head finalizers ; /* objects with, & reachable from, __del__ */
910910 PyGC_Head * gc ;
911- _PyTime_timeval t1 ;
911+ _PyTime_t t1 = 0 ; /* initialize to prevent a compiler warning */
912912
913913 struct gc_generation_stats * stats = & generation_stats [generation ];
914914
@@ -919,7 +919,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable,
919919 for (i = 0 ; i < NUM_GENERATIONS ; i ++ )
920920 PySys_FormatStderr (" %zd" ,
921921 gc_list_size (GEN_HEAD (i )));
922- _PyTime_monotonic ( & t1 );
922+ t1 = _PyTime_GetMonotonicClock ( );
923923
924924 PySys_WriteStderr ("\n" );
925925 }
@@ -1024,16 +1024,16 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable,
10241024 debug_cycle ("uncollectable" , FROM_GC (gc ));
10251025 }
10261026 if (debug & DEBUG_STATS ) {
1027- _PyTime_timeval t2 ;
1028- _PyTime_monotonic (& t2 );
1027+ _PyTime_t t2 = _PyTime_GetMonotonicClock ();
10291028
10301029 if (m == 0 && n == 0 )
10311030 PySys_WriteStderr ("gc: done" );
10321031 else
10331032 PySys_FormatStderr (
10341033 "gc: done, %zd unreachable, %zd uncollectable" ,
10351034 n + m , n );
1036- PySys_WriteStderr (", %.4fs elapsed\n" , _PyTime_INTERVAL (t1 , t2 ));
1035+ PySys_WriteStderr (", %.4fs elapsed\n" ,
1036+ _PyTime_AsSecondsDouble (t2 - t1 ));
10371037 }
10381038
10391039 /* Append instances in the uncollectable set to a Python
0 commit comments