summaryrefslogtreecommitdiffstats
path: root/common/diet/time.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-27 01:26:28 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-27 01:26:28 +0800
commitb27ece46a69aa7d5b9a759a2164609dab689f258 (patch)
treead7387b6b59ecfc3215deec393d1c932db8d09af /common/diet/time.c
parent1ac9e4897fdf8839328d9c47d1d2f0cc27b02f1d (diff)
downloadpttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.tar
pttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.tar.gz
pttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.tar.bz2
pttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.tar.lz
pttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.tar.xz
pttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.tar.zst
pttbbs-b27ece46a69aa7d5b9a759a2164609dab689f258.zip
(internal) refine directory layout: libbbs/libbbsutil -> common/bbs,sys.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4027 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/diet/time.c')
-rw-r--r--common/diet/time.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/diet/time.c b/common/diet/time.c
new file mode 100644
index 00000000..11f963c3
--- /dev/null
+++ b/common/diet/time.c
@@ -0,0 +1,20 @@
+#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);
+ 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