Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
the time module. time.clock_gettime(time.CLOCK_MONOTONIC) provides a monotonic
clock
diff --git a/setup.py b/setup.py
index 76566bd..97a92ba 100644
--- a/setup.py
+++ b/setup.py
@@ -504,11 +504,17 @@
         exts.append( Extension('math',  ['mathmodule.c', '_math.c'],
                                depends=['_math.h'],
                                libraries=math_libs) )
+
+        # time libraries: librt may be needed for clock_gettime()
+        time_libs = []
+        lib = sysconfig.get_config_var('TIMEMODULE_LIB')
+        if lib:
+            time_libs.append(lib)
+
         # time operations and variables
         exts.append( Extension('time', ['timemodule.c', '_time.c'],
-                               libraries=math_libs) )
-        exts.append( Extension('_datetime', ['_datetimemodule.c', '_time.c'],
-                               libraries=math_libs) )
+                               libraries=time_libs) )
+        exts.append( Extension('_datetime', ['_datetimemodule.c', '_time.c']) )
         # random number generator implemented in C
         exts.append( Extension("_random", ["_randommodule.c"]) )
         # bisect