summaryrefslogtreecommitdiffstats
path: root/mbbsd/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/time.c')
-rw-r--r--mbbsd/time.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mbbsd/time.c b/mbbsd/time.c
new file mode 100644
index 00000000..e692f668
--- /dev/null
+++ b/mbbsd/time.c
@@ -0,0 +1,22 @@
+#ifdef __dietlibc__
+#include <time.h>
+#warning "hardcoded time zone as GMT+8!"
+extern void __maplocaltime(void);
+extern time_t __tzfile_map(time_t t, int *isdst, int forward);
+extern time_t timegm(struct tm *const t);
+
+time_t mktime(register struct tm* const t) {
+ time_t x=timegm(t);
+ int isdst;
+ time_t y;
+ x-=8*3600;
+ return x;
+}
+
+struct tm* localtime_r(const time_t* t, struct tm* r) {
+ time_t tmp;
+ tmp=*t;
+ tmp+=8*3600;
+ return gmtime_r(&tmp,r);
+}
+#endif