From 23be72ae4534c13a7fd03f580934cc251ada619f Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 13 Jun 2012 14:41:52 -0400 Subject: [PATCH] add timegm function (inverse of gmtime), nonstandard --- include/time.h | 3 +++ src/time/timegm.c | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/time/timegm.c diff --git a/include/time.h b/include/time.h index 067b5196..ecdc66df 100644 --- a/include/time.h +++ b/include/time.h @@ -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 index 00000000..6d08917e --- /dev/null +++ b/src/time/timegm.c @@ -0,0 +1,9 @@ +#define _GNU_SOURCE +#include + +#include "__time.h" + +time_t timegm(struct tm *tm) +{ + return __tm_to_time(tm); +} -- 2.25.1