add timegm function (inverse of gmtime), nonstandard
authorRich Felker <dalias@aerifal.cx>
Wed, 13 Jun 2012 18:41:52 +0000 (14:41 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 13 Jun 2012 18:41:52 +0000 (14:41 -0400)
include/time.h
src/time/timegm.c [new file with mode: 0644]

index 067b5196812190f1b13b23b76218734f6961bf53..ecdc66dff781d05d92b8429ec40ffd7355b0355e 100644 (file)
@@ -114,6 +114,9 @@ struct tm *getdate (const char *);
 int stime(time_t *);
 #endif
 
+#if defined(_GNU_SOURCE)
+time_t timegm(struct tm *);
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/src/time/timegm.c b/src/time/timegm.c
new file mode 100644 (file)
index 0000000..6d08917
--- /dev/null
@@ -0,0 +1,9 @@
+#define _GNU_SOURCE
+#include <time.h>
+
+#include "__time.h"
+
+time_t timegm(struct tm *tm)
+{
+       return __tm_to_time(tm);
+}