Changeset: 9b4b9a2b8e02 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9b4b9a2b8e02
Modified Files:
        clients/mapilib/mapi.c
Branch: mapihandshake
Log Message:

Add fallback code for gmtime_r and localtime_r

Because mapi.c doesn't have access to the implementations in gdk_posix.c
we can't use those.


diffs (41 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -726,6 +726,37 @@
 # include <sys/time.h>         /* gettimeofday */
 #endif
 
+/* Copied from gdk_posix, but without taking a lock because we don't have 
access to
+ * MT_lock_set/unset here. We just have to hope for the best
+ */
+#ifndef HAVE_LOCALTIME_R
+struct tm *
+localtime_r(const time_t *restrict timep, struct tm *restrict result)
+{
+       struct tm *tmp;
+       tmp = localtime(timep);
+       if (tmp)
+               *result = *tmp;
+       return tmp ? result : NULL;
+}
+#endif
+
+/* Copied from gdk_posix, but without taking a lock because we don't have 
access to
+ * MT_lock_set/unset here. We just have to hope for the best
+ */
+#ifndef HAVE_GMTIME_R
+struct tm *
+gmtime_r(const time_t *restrict timep, struct tm *restrict result)
+{
+       struct tm *tmp;
+       tmp = gmtime(timep);
+       if (tmp)
+               *result = *tmp;
+       return tmp ? result : NULL;
+}
+#endif
+
+
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to