Revision: 6578
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6578&view=rev
Author:   thjc
Date:     2008-06-15 14:40:15 -0700 (Sun, 15 Jun 2008)

Log Message:
-----------
applied patch [ 1994158 ] clock_gettime replacement (2.1.0 Release won't build 
on Mac)

Modified Paths:
--------------
    code/player/branches/release-2-1-patches/ChangeLog
    code/player/branches/release-2-1-patches/configure.ac
    code/player/branches/release-2-1-patches/libplayercore/message.cc
    code/player/branches/release-2-1-patches/replace/replace.h

Added Paths:
-----------
    code/player/branches/release-2-1-patches/replace/clock_gettime.c

Modified: code/player/branches/release-2-1-patches/ChangeLog
===================================================================
--- code/player/branches/release-2-1-patches/ChangeLog  2008-06-14 05:37:08 UTC 
(rev 6577)
+++ code/player/branches/release-2-1-patches/ChangeLog  2008-06-15 21:40:15 UTC 
(rev 6578)
@@ -1,3 +1,6 @@
+2008-06-16: thjc
+       * Applied fix for missing clock_gettime on OSX
+
 2008-06-14
        * 2.1 released, Highliights include:
                * Static arrays in player interfaces replaced with dynamic 
arrays

Modified: code/player/branches/release-2-1-patches/configure.ac
===================================================================
--- code/player/branches/release-2-1-patches/configure.ac       2008-06-14 
05:37:08 UTC (rev 6577)
+++ code/player/branches/release-2-1-patches/configure.ac       2008-06-15 
21:40:15 UTC (rev 6578)
@@ -429,9 +429,20 @@
 dnl Checks for library functions.
 AC_REPLACE_FUNCS(poll dirname cfmakeraw round)
 AC_CHECK_FUNCS(sigblock getaddrinfo)
-AC_CHECK_LIB(rt, nanosleep)
 AC_CHECK_LIB(nsl, gethostbyname)
 AC_CHECK_LIB(socket, connect)
+
+dnl Look for nanosleep in librt (real time)
+dnl On some systems (Darwin) nanosleep is in libc instead
+AC_CHECK_LIB(rt, nanosleep)
+
+AC_CHECK_FUNC(clock_gettime, have_clock_gettime=yes, have_clock_gettime=no)
+if test "x$have_clock_gettime" = "xno"; then
+    AC_LIBOBJ(clock_gettime)
+    AC_DEFINE(NEED_CLOCK_GETTIME, 1, [Define to 1 if you do NOT have the 
clock_gettime function from librt])
+fi
+
+
 AC_CHECK_LIB(ltdl, lt_dlopenext,
              have_libltdl=yes
              LIBLTDL_FLAG=-lltdl

Modified: code/player/branches/release-2-1-patches/libplayercore/message.cc
===================================================================
--- code/player/branches/release-2-1-patches/libplayercore/message.cc   
2008-06-14 05:37:08 UTC (rev 6577)
+++ code/player/branches/release-2-1-patches/libplayercore/message.cc   
2008-06-15 21:40:15 UTC (rev 6578)
@@ -55,6 +55,7 @@
 #include <libplayercore/error.h>
 #include <libplayercore/interface_util.h>
 #include <libplayerxdr/playerxdr.h>
+#include <replace/replace.h>
 
 Message::Message(const struct player_msghdr & aHeader,
                   void * data,

Added: code/player/branches/release-2-1-patches/replace/clock_gettime.c
===================================================================
--- code/player/branches/release-2-1-patches/replace/clock_gettime.c            
                (rev 0)
+++ code/player/branches/release-2-1-patches/replace/clock_gettime.c    
2008-06-15 21:40:15 UTC (rev 6578)
@@ -0,0 +1,40 @@
+/*
+ *  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 <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;
+}


Property changes on: 
code/player/branches/release-2-1-patches/replace/clock_gettime.c
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: code/player/branches/release-2-1-patches/replace/replace.h
===================================================================
--- code/player/branches/release-2-1-patches/replace/replace.h  2008-06-14 
05:37:08 UTC (rev 6577)
+++ code/player/branches/release-2-1-patches/replace/replace.h  2008-06-15 
21:40:15 UTC (rev 6578)
@@ -95,6 +95,12 @@
   unsigned long compressBound (unsigned long sourceLen);
 #endif // NEED_COMPRESSBOUND
 
+#if NEED_CLOCK_GETTIME
+    #define CLOCK_REALTIME 0
+    int clock_gettime(int clk_id, struct timespec *tp);
+#endif
+    
+
 #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