summaryrefslogtreecommitdiff
path: root/config.h.cmake
diff options
context:
space:
mode:
authorMarkus Minichmayr <markus@tapkey.com>2022-02-23 15:39:05 +0100
committerAllen Winter <allen.winter@kdab.com>2022-06-03 11:17:08 -0400
commitacf1ae1dacb43f967b289e0922856703c1e15d1f (patch)
treef1de772d0203321693202dfdd742fa82bba12428 /config.h.cmake
parentd88473bc53f32a54f18d976a97cc4d39f8902848 (diff)
downloadlibical-git-acf1ae1dacb43f967b289e0922856703c1e15d1f.tar.gz
time_t - replace type `time_t` and related functions with our own `icaltime_t`, etc. and define it centrally in `config_public.h.cmake` and `config.h.cmake`. This allows for easy replacement, should the system-defined time_t not be suitable. This might especially be the case on 32-bit systems where the range of time_t ends 2038.
Diffstat (limited to 'config.h.cmake')
-rw-r--r--config.h.cmake13
1 files changed, 12 insertions, 1 deletions
diff --git a/config.h.cmake b/config.h.cmake
index aae1cf8a..561b91a8 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -522,7 +522,18 @@ typedef ssize_t IO_SSIZE_T;
/* FYI: The localtime() in Microsoft's C library is MT-safe */
#define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
#endif
-#include <time.h>
+
+#define SIZEOF_ICALTIME_T SIZEOF_TIME_T
+
+/*
+ * Substitute functions for those from time.h but working with icaltime_t instead of time_t.
+ * icaltime_t is defined in config_public.h.cmake.
+ */
+#define icaltime(timer) time(timer)
+#define icalctime(timer) ctime(timer)
+#define icalmktime(timeptr) mktime(timeptr)
+#define icalgmtime_r(timer, buf) gmtime_r(timer, buf)
+#define icallocaltime_r(timer, buf) localtime_r(timer, buf)
/* define MAXPATHLEN */
#if defined(_WIN32)