aboutsummaryrefslogtreecommitdiff
path: root/time/timegm.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/timegm.c')
-rw-r--r--time/timegm.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/time/timegm.c b/time/timegm.c
index bfd36d0..bae0cee 100644
--- a/time/timegm.c
+++ b/time/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