The attached patches add wrappers for the remaining functions
(gettimeofday, gmtime_r, and localtime_r) in need of wrapping
on NetBSD.
/Krister
--- libraries/old-time/include/HsTime.h.orig 2009-08-14 18:50:18.000000000
+0200
+++ libraries/old-time/include/HsTime.h 2009-08-14 18:58:32.000000000 +0200
@@ -34,4 +34,16 @@
extern long *__hscore_timezone( void );
extern char **__hscore_tzname( void );
+#if HAVE_GETTIMEOFDAY
+extern int __hscore_gettimeofday(struct timeval *tp, void *tzp);
+#endif
+
+#if HAVE_GMTIME_R
+extern struct tm *__hscore_gmtime_r(const time_t *clock, struct tm *result);
+#endif
+
+#if HAVE_LOCALTIME_R
+extern struct tm *__hscore_localtime_r(const time_t *clock, struct tm *result);
+#endif
+
#endif /* __TIMEUTILS_H__ */
--- libraries/old-time/cbits/timeUtils.c.orig 2009-08-14 18:50:45.000000000
+0200
+++ libraries/old-time/cbits/timeUtils.c 2009-08-14 19:01:22.000000000
+0200
@@ -6,6 +6,27 @@
*/
#include "HsTime.h"
+#if HAVE_GETTIMEOFDAY
+int __hscore_gettimeofday(struct timeval *tp, void *tzp)
+{
+ return gettimeofday(tp, tzp);
+}
+#endif
+
+#if HAVE_GMTIME_R
+struct tm *__hscore_gmtime_r(const time_t *clock, struct tm *result)
+{
+ return gmtime_r(clock, result);
+}
+#endif
+
+#if HAVE_LOCALTIME_R
+struct tm *__hscore_localtime_r(const time_t *clock, struct tm *result)
+{
+ return localtime_r(clock, result);
+}
+#endif
+
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) /* to the end
*/
long *__hscore_timezone( void )
--- libraries/old-time/System/Time.hsc.orig 2009-08-14 18:51:28.000000000
+0200
+++ libraries/old-time/System/Time.hsc 2009-08-14 19:03:25.000000000 +0200
@@ -731,14 +731,14 @@
type CTm = () -- struct tm
#if HAVE_LOCALTIME_R
-foreign import ccall unsafe "time.h localtime_r"
+foreign import ccall unsafe "HsTime.h __hscore_localtime_r"
localtime_r :: Ptr CTime -> Ptr CTm -> IO (Ptr CTm)
#else
foreign import ccall unsafe "time.h localtime"
localtime :: Ptr CTime -> IO (Ptr CTm)
#endif
#if HAVE_GMTIME_R
-foreign import ccall unsafe "time.h gmtime_r"
+foreign import ccall unsafe "HsTime.h __hscore_gmtime_r"
gmtime_r :: Ptr CTime -> Ptr CTm -> IO (Ptr CTm)
#else
foreign import ccall unsafe "time.h gmtime"
@@ -750,7 +750,7 @@
#if HAVE_GETTIMEOFDAY
type CTimeVal = ()
type CTimeZone = ()
-foreign import ccall unsafe "time.h gettimeofday"
+foreign import ccall unsafe "HsTime.h __hscore_gettimeofday"
gettimeofday :: Ptr CTimeVal -> Ptr CTimeZone -> IO CInt
#elif HAVE_FTIME
type CTimeB = ()
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc