소스 검색

add timegm function (inverse of gmtime), nonstandard

Rich Felker 13 년 전
부모
커밋
23be72ae45
2개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      include/time.h
  2. 9 0
      src/time/timegm.c

+ 3 - 0
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
 }

+ 9 - 0
src/time/timegm.c

@@ -0,0 +1,9 @@
+#define _GNU_SOURCE
+#include <time.h>
+
+#include "__time.h"
+
+time_t timegm(struct tm *tm)
+{
+	return __tm_to_time(tm);
+}