linux: unbreak build if HAVE_MONOTONIC_CLOCK=0
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 28 Oct 2011 21:29:56 +0000 (23:29 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 28 Oct 2011 21:47:08 +0000 (23:47 +0200)
src/platform_linux.cc
wscript

index ae281606c025000ba51bc5a8ee916dd5317851d4..287ed3e306c7b9660e0419a1f1c3445f427413e6 100644 (file)
 #include <sys/ioctl.h>
 #include <net/if.h>
 
-#if HAVE_MONOTONIC_CLOCK
 #include <time.h>
+
+#ifndef CLOCK_MONOTONIC
+# include <sys/sysinfo.h>
 #endif
 
 extern char **environ;
@@ -296,7 +298,7 @@ int Platform::GetCPUInfo(Local<Array> *cpus) {
 }
 
 double Platform::GetUptimeImpl() {
-#if HAVE_MONOTONIC_CLOCK
+#ifdef CLOCK_MONOTONIC
   struct timespec now;
   if (0 == clock_gettime(CLOCK_MONOTONIC, &now)) {
     double uptime = now.tv_sec;
diff --git a/wscript b/wscript
index 7457339aa1306a04d7351be17e6a394e9eeaa136..006b0d95ead68bee46fd6e967fd8e03da0afdbc1 100644 (file)
--- a/wscript
+++ b/wscript
@@ -380,23 +380,6 @@ def configure(conf):
 
   have_librt = conf.check(lib='rt', uselib_store='RT')
 
-  have_monotonic = False
-  if have_librt:
-    code =  """
-      #include <time.h>
-      int main(void) {
-        struct timespec now;
-        clock_gettime(CLOCK_MONOTONIC, &now);
-        return 0;
-      }
-    """
-    have_monotonic = conf.check_cc(lib="rt", msg="Checking for CLOCK_MONOTONIC", fragment=code)
-
-  if have_monotonic:
-    conf.env.append_value('CPPFLAGS', '-DHAVE_MONOTONIC_CLOCK=1')
-  else:
-    conf.env.append_value('CPPFLAGS', '-DHAVE_MONOTONIC_CLOCK=0')
-
   if sys.platform.startswith("sunos"):
     code =  """
       #include <ifaddrs.h>