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 067b519..ecdc66d 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);
+}