gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29506 - in libmicrohttpd: . src/microhttpd src/microspdy s


From: gnunet
Subject: [GNUnet-SVN] r29506 - in libmicrohttpd: . src/microhttpd src/microspdy src/spdy2http src/testspdy
Date: Mon, 23 Sep 2013 20:34:19 +0200

Author: grothoff
Date: 2013-09-23 20:34:19 +0200 (Mon, 23 Sep 2013)
New Revision: 29506

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/internal.c
   libmicrohttpd/src/microspdy/EXPORT.sym
   libmicrohttpd/src/microspdy/internal.c
   libmicrohttpd/src/spdy2http/proxy.c
   libmicrohttpd/src/testspdy/test_session_timeout.c
Log:
check CLOCK_MONOTONIC is defined

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2013-09-23 18:23:12 UTC (rev 29505)
+++ libmicrohttpd/ChangeLog     2013-09-23 18:34:19 UTC (rev 29506)
@@ -1,3 +1,7 @@
+Mon Sep 23 20:24:48 CEST 2013
+       Fixing build issues on OS X with CLOCK_MONOTONIC not being
+       implemented on OS X. -CG
+
 Mon Sep 23 14:15:00 CEST 2013
        Make libmicrohttpd play nicely with upcoming libgcrypt 1.6.0. -CG
 

Modified: libmicrohttpd/src/microhttpd/internal.c
===================================================================
--- libmicrohttpd/src/microhttpd/internal.c     2013-09-23 18:23:12 UTC (rev 
29505)
+++ libmicrohttpd/src/microhttpd/internal.c     2013-09-23 18:34:19 UTC (rev 
29506)
@@ -158,14 +158,19 @@
   return wpos - val; /* = strlen(val) */
 }
 
-time_t MHD_monotonic_time(void)
+
+time_t 
+MHD_monotonic_time (void)
 {
 #ifdef HAVE_CLOCK_GETTIME
-    struct timespec ts;
-    if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
-       return ts.tv_sec;
+#ifdef CLOCK_MONOTONIC
+  struct timespec ts;
+
+  if (0 == clock_gettime (CLOCK_MONOTONIC, &ts))
+    return ts.tv_sec;
 #endif
-    return time(NULL);
+#endif
+  return time (NULL);
 }
 
 /* end of internal.c */

Modified: libmicrohttpd/src/microspdy/EXPORT.sym
===================================================================
--- libmicrohttpd/src/microspdy/EXPORT.sym      2013-09-23 18:23:12 UTC (rev 
29505)
+++ libmicrohttpd/src/microspdy/EXPORT.sym      2013-09-23 18:34:19 UTC (rev 
29506)
@@ -1,2 +1,3 @@
 SPDY_start_daemon
 SPDY_stop_daemon
+SPDYF_monotonic_time

Modified: libmicrohttpd/src/microspdy/internal.c
===================================================================
--- libmicrohttpd/src/microspdy/internal.c      2013-09-23 18:23:12 UTC (rev 
29505)
+++ libmicrohttpd/src/microspdy/internal.c      2013-09-23 18:34:19 UTC (rev 
29506)
@@ -27,12 +27,14 @@
 
 
 unsigned long long
-SPDYF_monotonic_time(void)
+SPDYF_monotonic_time (void)
 {
 #ifdef HAVE_CLOCK_GETTIME
+#ifdef CLOCK_MONOTONIC
   struct timespec ts;
-  if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
+  if (0 == clock_gettime (CLOCK_MONOTONIC, &ts))
     return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
 #endif
-    return time(NULL) * 1000;
+#endif
+  return time (NULL) * 1000;
 }

Modified: libmicrohttpd/src/spdy2http/proxy.c
===================================================================
--- libmicrohttpd/src/spdy2http/proxy.c 2013-09-23 18:23:12 UTC (rev 29505)
+++ libmicrohttpd/src/spdy2http/proxy.c 2013-09-23 18:34:19 UTC (rev 29506)
@@ -244,12 +244,29 @@
     
   (*uri)->full_uri = strdup(full_uri);
   
-  asprintf(&((*uri)->scheme), "%.*s",pmatch[2].rm_eo - pmatch[2].rm_so, 
&full_uri[pmatch[2].rm_so]);
-  asprintf(&((*uri)->host_and_port), "%.*s",pmatch[4].rm_eo - pmatch[4].rm_so, 
&full_uri[pmatch[4].rm_so]);
-  asprintf(&((*uri)->path), "%.*s",pmatch[5].rm_eo - pmatch[5].rm_so, 
&full_uri[pmatch[5].rm_so]);
-  asprintf(&((*uri)->path_and_more), "%.*s",pmatch[9].rm_eo - pmatch[5].rm_so, 
&full_uri[pmatch[5].rm_so]);
-  asprintf(&((*uri)->query), "%.*s",pmatch[7].rm_eo - pmatch[7].rm_so, 
&full_uri[pmatch[7].rm_so]);
-  asprintf(&((*uri)->fragment), "%.*s",pmatch[9].rm_eo - pmatch[9].rm_so, 
&full_uri[pmatch[9].rm_so]);
+  asprintf(&((*uri)->scheme),
+          "%.*s", 
+          (int) (pmatch[2].rm_eo - pmatch[2].rm_so), 
+          &full_uri[pmatch[2].rm_so]);
+  asprintf(&((*uri)->host_and_port), "%.*s", 
+          (int) (pmatch[4].rm_eo - pmatch[4].rm_so),
+          &full_uri[pmatch[4].rm_so]);
+  asprintf(&((*uri)->path),
+          "%.*s",
+          (int) (pmatch[5].rm_eo - pmatch[5].rm_so), 
+          &full_uri[pmatch[5].rm_so]);
+  asprintf(&((*uri)->path_and_more), 
+          "%.*s",
+          (int) (pmatch[9].rm_eo - pmatch[5].rm_so), 
+          &full_uri[pmatch[5].rm_so]);
+  asprintf(&((*uri)->query),
+          "%.*s",
+          (int) (pmatch[7].rm_eo - pmatch[7].rm_so),
+          &full_uri[pmatch[7].rm_so]);
+  asprintf(&((*uri)->fragment), 
+          "%.*s",
+          (int) (pmatch[9].rm_eo - pmatch[9].rm_so),
+          &full_uri[pmatch[9].rm_so]);
   
   colon = strrchr((*uri)->host_and_port, ':');
   if(NULL == colon)
@@ -1173,12 +1190,17 @@
     if(glob_opt.verbose)
     {
       
+#ifdef HAVE_CLOCK_GETTIME
+#ifdef CLOCK_MONOTONIC    
     struct timespec ts;
-#ifdef CLOCK_MONOTONIC    
-    if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
-    PRINT_VERBOSE2("time now %lld %lld", (unsigned long long)ts.tv_sec, 
(unsigned long long)ts.tv_nsec);
+
+    if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
+    PRINT_VERBOSE2 ("time now %lld %lld",
+                   (unsigned long long) ts.tv_sec,
+                   (unsigned long long) ts.tv_nsec);
     }
 #endif
+#endif
   }
   while(loop);
 

Modified: libmicrohttpd/src/testspdy/test_session_timeout.c
===================================================================
--- libmicrohttpd/src/testspdy/test_session_timeout.c   2013-09-23 18:23:12 UTC 
(rev 29505)
+++ libmicrohttpd/src/testspdy/test_session_timeout.c   2013-09-23 18:34:19 UTC 
(rev 29506)
@@ -31,6 +31,7 @@
 #include "common.h"
 #include <sys/time.h>
 #include <sys/stat.h>
+#include "../microspdy/internal.h"
 
 #define TIMEOUT 2
 #define SELECT_MS_TIMEOUT 20
@@ -102,7 +103,6 @@
        int childstatus;
        unsigned long long timeoutlong=0;
        struct timeval timeout;
-       struct timespec ts;
        int ret;
        fd_set read_fd_set;
        fd_set write_fd_set;
@@ -150,10 +150,7 @@
                        {
                                killchild("SPDY_get_timeout returned wrong 
timeout");
                        }*/
-      if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
-        now = ts.tv_nsec / 1000000 + ts.tv_sec*1000;
-      else
-                               killchild("clock_gettime returned wrong value");
+                       now = SPDYF_monotonic_time ();
       if(now - beginning > TIMEOUT*1000 + SELECT_MS_TIMEOUT)
       {
         printf("Started at: %llums\n",beginning);
@@ -217,10 +214,7 @@
                                SPDY_run(daemon);
         if(0 == beginning)
         {
-          if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
-            beginning = ts.tv_nsec / 1000000 + ts.tv_sec*1000;
-          else
-            killchild("clock_gettime returned wrong number");
+         beginning = SPDYF_monotonic_time ();
         }
                                /*if(do_sleep)
                                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]