diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-24 05:02:41 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-24 05:02:41 +0800 |
commit | c8ca89f87d8fbd2e642a2787acb9bf02614ffe04 (patch) | |
tree | e77117feab4f369e738c53fbd05d4649564238bb /mbbsd/time.c | |
parent | f30ceeae171f34b4565eecf8fdcf674aee2edb54 (diff) | |
download | pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.tar pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.tar.gz pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.tar.bz2 pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.tar.lz pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.tar.xz pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.tar.zst pttbbs-c8ca89f87d8fbd2e642a2787acb9bf02614ffe04.zip |
add dietlibc support, reduced 16kb memory usage on linux x86_64.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2534 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/time.c')
-rw-r--r-- | mbbsd/time.c | 22 |
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 |