diff options
Diffstat (limited to 'Build/source/libs/poppler/poppler-src/goo')
-rw-r--r-- | Build/source/libs/poppler/poppler-src/goo/Makefile.am | 5 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-src/goo/glibc.cc | 58 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-src/goo/glibc.h | 37 |
3 files changed, 99 insertions, 1 deletions
diff --git a/Build/source/libs/poppler/poppler-src/goo/Makefile.am b/Build/source/libs/poppler/poppler-src/goo/Makefile.am index 370e85021be..004775a487c 100644 --- a/Build/source/libs/poppler/poppler-src/goo/Makefile.am +++ b/Build/source/libs/poppler/poppler-src/goo/Makefile.am @@ -40,7 +40,8 @@ libgoo_la_SOURCES = \ ImgWriter.cc \ gtypes_p.h \ gstrtod.cc \ - grandom.cc + grandom.cc \ + glibc.cc if BUILD_LIBJPEG libjpeg_includes = $(LIBJPEG_CFLAGS) @@ -64,3 +65,5 @@ libgoo_la_CPPFLAGS = \ $(libtiff_includes) \ $(libjpeg2000_includes) \ $(libpng_includes) + +EXTRA_DIST = glibc.h
\ No newline at end of file diff --git a/Build/source/libs/poppler/poppler-src/goo/glibc.cc b/Build/source/libs/poppler/poppler-src/goo/glibc.cc new file mode 100644 index 00000000000..4968047feea --- /dev/null +++ b/Build/source/libs/poppler/poppler-src/goo/glibc.cc @@ -0,0 +1,58 @@ +//======================================================================== +// +// glibc.h +// +// Emulate various non-portable glibc functions. +// +// This file is licensed under the GPLv2 or later +// +// Copyright (C) 2016 Adrian Johnson <ajohnson@redneon.com> +// +//======================================================================== + +#include "glibc.h" + +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *result) +{ + struct tm *gt; + gt = gmtime(timep); + if (gt) + *result = *gt; + return gt; +} +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *timep, struct tm *result) +{ + struct tm *lt; + lt = localtime(timep); + *result = *lt; + return lt; +} +#endif + +#ifndef HAVE_TIMEGM +// Get offset of local time from UTC in seconds. DST is ignored. +static time_t getLocalTimeZoneOffset() +{ + time_t utc, local; + struct tm tm_utc; + time (&utc); + gmtime_r(&utc, &tm_utc); + local = mktime(&tm_utc); + return difftime(utc, local); +} + +time_t timegm(struct tm *tm) +{ + tm->tm_isdst = 0; + time_t t = mktime(tm); + if (t == -1) + return t; + + t += getLocalTimeZoneOffset(); + return t; +} +#endif diff --git a/Build/source/libs/poppler/poppler-src/goo/glibc.h b/Build/source/libs/poppler/poppler-src/goo/glibc.h new file mode 100644 index 00000000000..49479e9d2a6 --- /dev/null +++ b/Build/source/libs/poppler/poppler-src/goo/glibc.h @@ -0,0 +1,37 @@ +//======================================================================== +// +// glibc.h +// +// Emulate various non-portable glibc functions. +// +// This file is licensed under the GPLv2 or later +// +// Copyright (C) 2016 Adrian Johnson <ajohnson@redneon.com> +// +//======================================================================== + +#ifndef GLIBC_H +#define GLIBC_H + +#include "config.h" + +#include <time.h> + +extern "C" { + +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *timep, struct tm *result); +#endif + +#ifndef HAVE_TIMEGM +time_t timegm(struct tm *tm); +#endif + +}; + +#endif // GLIBC_H + |