summaryrefslogtreecommitdiffstats
path: root/mbbsd/stuff.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-01-24 22:06:48 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-01-24 22:06:48 +0800
commit9084d9602e8725a6fb832d4396c12ddd7bb2b7c7 (patch)
tree78d04dab42a50e73845c8e31eb877001fb8379cd /mbbsd/stuff.c
parentf6324fdcb56a70815842cc39cb1826ce6b82148c (diff)
downloadpttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.tar
pttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.tar.gz
pttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.tar.bz2
pttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.tar.lz
pttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.tar.xz
pttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.tar.zst
pttbbs-9084d9602e8725a6fb832d4396c12ddd7bb2b7c7.zip
use time4_t(uint32_t) instead of time_t for x86-64 arch.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2426 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/stuff.c')
-rw-r--r--mbbsd/stuff.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index d3c6c9b0..569bddc0 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -299,7 +299,7 @@ dashs(char *fname)
* ¶Ç¦^ fname ªº mtime
* @param fname
*/
-time_t
+time4_t
dasht(char *fname)
{
struct stat st;
@@ -468,12 +468,12 @@ ipstr2int(char *ip)
}
#ifndef _BBS_UTIL_C_ /* getdata_buf */
-time_t
-gettime(int line, time_t dt, char*head)
+time4_t
+gettime(int line, time4_t dt, char*head)
{
char yn[7];
int i;
- struct tm *ptime = localtime(&dt), endtime;
+ struct tm *ptime = localtime4(&dt), endtime;
memcpy(&endtime, ptime, sizeof(struct tm));
snprintf(yn, sizeof(yn), "%4d", ptime->tm_year + 1900);
@@ -499,30 +499,33 @@ gettime(int line, time_t dt, char*head)
#endif
char *
-Cdate(time_t * clock)
+Cdate(time4_t *clock)
{
static char foo[32];
- struct tm *mytm = localtime(clock);
+ time_t temp = (time_t)*clock;
+ struct tm *mytm = localtime(&temp);
strftime(foo, 32, "%m/%d/%Y %T %a", mytm);
return foo;
}
char *
-Cdatelite(time_t * clock)
+Cdatelite(time4_t *clock)
{
static char foo[32];
- struct tm *mytm = localtime(clock);
+ time_t temp = (time_t)*clock;
+ struct tm *mytm = localtime(&temp);
strftime(foo, 32, "%m/%d/%Y %T", mytm);
return foo;
}
char *
-Cdatedate(time_t * clock)
+Cdatedate(time4_t * clock)
{
static char foo[32];
- struct tm *mytm = localtime(clock);
+ time_t temp = (time_t)*clock;
+ struct tm *mytm = localtime(&temp);
strftime(foo, 32, "%m/%d/%Y", mytm);
return foo;
@@ -935,6 +938,24 @@ int qsort_intcompar(const void *a, const void *b)
return *(int *)a - *(int *)b;
}
+struct tm *localtime4(time4_t *t)
+{
+ if( t == NULL )
+ return localtime(NULL);
+ else {
+ time_t temp = (time_t)*t;
+ return localtime(&temp);
+ }
+}
+
+time4_t time4(time4_t *ptr)
+{
+ if( ptr == NULL )
+ return time(NULL);
+ else
+ return *ptr = (time4_t)time(NULL);
+}
+
#ifdef OUTTACACHE
#include <err.h>
int tobind(int port)