diff options
Diffstat (limited to 'lib/timegm.c')
-rw-r--r-- | lib/timegm.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/timegm.c b/lib/timegm.c index 2ca57444d43..c440480cb2d 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -18,17 +18,41 @@ <http://www.gnu.org/licenses/>. */ #ifndef _LIBC -# include <config.h> +# include <libc-config.h> #endif #include <time.h> +#include <errno.h> #include "mktime-internal.h" -time_t -timegm (struct tm *tmp) +__time64_t +__timegm64 (struct tm *tmp) { static mktime_offset_t gmtime_offset; tmp->tm_isdst = 0; - return __mktime_internal (tmp, __gmtime_r, &gmtime_offset); + return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset); } + +#if defined _LIBC && __TIMESIZE != 64 + +libc_hidden_def (__timegm64) + +time_t +timegm (struct tm *tmp) +{ + struct tm tm = *tmp; + __time64_t t = __timegm64 (&tm); + if (in_time_t_range (t)) + { + *tmp = tm; + return t; + } + else + { + __set_errno (EOVERFLOW); + return -1; + } +} + +#endif |