]> git.sesse.net Git - vlc/blobdiff - include/vlc_fixups.h
Factorize the localtime_r replacement
[vlc] / include / vlc_fixups.h
index 4008ce8411ca34702137bd9894ce6c2faba55411..ca9c667925d844fa3a38c1e68e0464ee48b03c7d 100644 (file)
 # endif
 #endif
 
+#ifndef HAVE_LOCALTIME_R
+/* If localtime_r() is not provided, we assume localtime() uses
+ * thread-specific storage. */
+# include <time.h>
+static struct tm *localtime_r (const time_t *timep, struct tm *result)
+{
+    struct tm *s = localtime (timep);
+    if (s == NULL)
+        return NULL;
+
+    *result = *s;
+    return result;
+}
+#endif
+