Revision: 6580
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6580&view=rev
Author:   gbiggs
Date:     2008-06-15 18:53:44 -0700 (Sun, 15 Jun 2008)

Log Message:
-----------
Merging change 6578 from 2.1 branch

Modified Paths:
--------------
    code/player/trunk/cmake/internal/SearchForStuff.cmake
    code/player/trunk/libplayercore/message.cc
    code/player/trunk/playerconfig.h.in
    code/player/trunk/replace/replace.h

Added Paths:
-----------
    code/player/trunk/replace/clock_gettime.c

Modified: code/player/trunk/cmake/internal/SearchForStuff.cmake
===================================================================
--- code/player/trunk/cmake/internal/SearchForStuff.cmake       2008-06-16 
00:54:14 UTC (rev 6579)
+++ code/player/trunk/cmake/internal/SearchForStuff.cmake       2008-06-16 
01:53:44 UTC (rev 6580)
@@ -16,7 +16,6 @@
 CHECK_FUNCTION_EXISTS (round HAVE_ROUND)
 CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
 CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
-CHECK_FUNCTION_EXISTS (compressBound NEED_COMPRESSBOUND)
 CHECK_INCLUDE_FILES (dns_sd.h HAVE_DNS_SD)
 IF (HAVE_DNS_SD)
     CHECK_LIBRARY_EXISTS (dns_sd DNSServiceRefDeallocate "" HAVE_DNS_SD)
@@ -27,6 +26,11 @@
 IF (HAVE_LIBJPEG AND HAVE_JPEGLIB_H)
     SET (HAVE_JPEG TRUE)
 ENDIF (HAVE_LIBJPEG AND HAVE_JPEGLIB_H)
+SET (CMAKE_REQUIRED_INCLUDES zlib.h)
+SET (CMAKE_REQUIRED_LIBRARIES z)
+CHECK_FUNCTION_EXISTS (compressBound HAVE_COMPRESSBOUND)
+SET (CMAKE_REQUIRED_INCLUDES)
+SET (CMAKE_REQUIRED_LIBRARIES)
 
 CHECK_LIBRARY_EXISTS (z compress2 "" HAVE_LIBZ)
 CHECK_INCLUDE_FILES (zlib.h HAVE_ZLIB_H)
@@ -34,6 +38,14 @@
     SET (HAVE_Z TRUE)
 ENDIF (HAVE_LIBZ AND HAVE_ZLIB_H)
 
+CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_LIBRT)
+SET (CMAKE_REQUIRED_LIBRARIES rt)
+CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME_FUNC)
+SET (CMAKE_REQUIRED_LIBRARIES)
+IF (HAVE_LIBRT AND HAVE_CLOCK_GETTIME_FUNC)
+    SET (HAVE_CLOCK_GETTIME TRUE)
+ENDIF (HAVE_LIBRT AND HAVE_CLOCK_GETTIME_FUNC)
+
 # Endianess check
 INCLUDE (TestBigEndian)
 TEST_BIG_ENDIAN (WORDS_BIGENDIAN)

Modified: code/player/trunk/libplayercore/message.cc
===================================================================
--- code/player/trunk/libplayercore/message.cc  2008-06-16 00:54:14 UTC (rev 
6579)
+++ code/player/trunk/libplayercore/message.cc  2008-06-16 01:53:44 UTC (rev 
6580)
@@ -55,6 +55,7 @@
 #include <libplayercore/error.h>
 #include <libplayercore/interface_util.h>
 #include <playerxdr.h>
+#include <replace/replace.h>
 
 Message::Message(const struct player_msghdr & aHeader,
                   void * data,

Modified: code/player/trunk/playerconfig.h.in
===================================================================
--- code/player/trunk/playerconfig.h.in 2008-06-16 00:54:14 UTC (rev 6579)
+++ code/player/trunk/playerconfig.h.in 2008-06-16 01:53:44 UTC (rev 6580)
@@ -6,8 +6,9 @@
 #cmakedefine HAVE_POLL 1
 #cmakedefine HAVE_ROUND 1
 #cmakedefine HAVE_STDINT_H 1
-#cmakedefine NEED_COMPRESSBOUND 1
+#cmakedefine HAVE_COMPRESSBOUND 1
 #cmakedefine INCLUDE_RTKGUI 1
+#cmakedefine HAVE_CLOCK_GETTIME 1
 
 #ifdef HAVE_STDINT_H
 #include <stdint.h>

Copied: code/player/trunk/replace/clock_gettime.c (from rev 6578, 
code/player/branches/release-2-1-patches/replace/clock_gettime.c)
===================================================================
--- code/player/trunk/replace/clock_gettime.c                           (rev 0)
+++ code/player/trunk/replace/clock_gettime.c   2008-06-16 01:53:44 UTC (rev 
6580)
@@ -0,0 +1,46 @@
+/*
+ *  Player - One Hell of a Robot Server
+ *  Copyright (C) 2008
+ *     Brian Gerkey - Player
+ *     Klaas Gadeyne - clock_gettime replacement function
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <playerconfig.h>
+
+#if defined (HAVE_CLOCK_GETTIME)
+
+#include <sys/time.h>
+
+/* This replacement function originally written by Klass Gadeyne
+   for the Orocos Project */
+int clock_gettime(int clk_id /*ignored*/, struct timespec *tp)
+{
+    struct timeval now;
+    int rv = gettimeofday(&now, NULL);
+    if (rv != 0) 
+    {
+        tp->tv_sec = 0;
+        tp->tv_nsec = 0;
+        return rv;
+    }
+    tp->tv_sec = now.tv_sec;
+    tp->tv_nsec = now.tv_usec * 1000;
+    return 0;
+}
+
+#endif // defined (HAVE_CLOCK_GETTIME)

Modified: code/player/trunk/replace/replace.h
===================================================================
--- code/player/trunk/replace/replace.h 2008-06-16 00:54:14 UTC (rev 6579)
+++ code/player/trunk/replace/replace.h 2008-06-16 01:53:44 UTC (rev 6580)
@@ -89,10 +89,15 @@
   double round (double x);
 #endif // !HAVE_ROUND
 
-#if NEED_COMPRESSBOUND
+#if !HAVE_COMPRESSBOUND
   unsigned long compressBound (unsigned long sourceLen);
-#endif // NEED_COMPRESSBOUND
+#endif // HAVE_COMPRESSBOUND
 
+#if !HAVE_CLOCK_GETTIME
+  #define CLOCK_REALTIME 0
+  int clock_gettime(int clk_id, struct timespec *tp);
+#endif // !HAVE_CLOCK_GETTIME
+    
 #ifdef __cplusplus
 }
 #endif


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to