lib/util: move TIME_T_MIN/MAX defines into header file
[ira/wip.git] / lib / util / time.h
index e40de2de3df9431c9d93aed6415939b1ea06a59e..cf6dc1caa7584f722e656f4a1e39dbfd3feb72c2 100644 (file)
 #define _PUBLIC_
 #endif
 
+#ifndef TIME_T_MIN
+/* we use 0 here, because (time_t)-1 means error */
+#define TIME_T_MIN 0
+#endif
+
+/*
+ * we use the INT32_MAX here as on 64 bit systems,
+ * gmtime() fails with INT64_MAX
+ */
+#ifndef TIME_T_MAX
+#define TIME_T_MAX MIN(INT32_MAX,_TYPE_MAXIMUM(time_t))
+#endif
+
+
 /* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30, 4 byte aligned */
 typedef uint64_t NTTIME;