From 8c6b2e7e9d30bb3a9ef4fd8632cbf6d8d0673bb7 Mon Sep 17 00:00:00 2001 From: Blake Jones Date: Wed, 21 Aug 2013 13:09:54 +0200 Subject: timegm: add portable implementation (Solaris support) The timegm(3) function is a non-standard extension to libc which is available in GNU libc and on some BSDs. Although SunOS had this function in its libc, Solaris (unfortunately) removed it. This patch implements a very simple version of timegm() which is good enough for parse-time-string.c. Signed-off-by: Vladimir Marek --- compat/compat.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compat/compat.h') diff --git a/compat/compat.h b/compat/compat.h index ae762c30..5a402d5c 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -57,6 +57,11 @@ char* strcasestr(const char *haystack, const char *needle); char *strsep(char **stringp, const char *delim); #endif /* !HAVE_STRSEP */ +#if !HAVE_TIMEGM +#include +time_t timegm (struct tm *tm); +#endif /* !HAVE_TIMEGM */ + /* Silence gcc warnings about unused results. These warnings exist * for a reason; any use of this needs to be justified. */ #ifdef __GNUC__ -- cgit v1.2.3