--- sbbs/src/sbbs3/date_str.c 2018/04/24 16:41:23 1.1 +++ sbbs/src/sbbs3/date_str.c 2018/04/24 16:42:45 1.1.1.2 @@ -2,13 +2,13 @@ /* Synchronet date/time string conversion routines */ -/* $Id: date_str.c,v 1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: date_str.c,v 1.1.1.2 2018/04/24 16:42:45 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -80,10 +80,12 @@ time_t DLLCALL dstrtounix(scfg_t* cfg, c tm.tm_year+=100; if(cfg->sys_misc&SM_EURODATE) { tm.tm_mon=((p[3]&0xf)*10)+(p[4]&0xf); - tm.tm_mday=((p[0]&0xf)*10)+(p[1]&0xf); } + tm.tm_mday=((p[0]&0xf)*10)+(p[1]&0xf); + } else { tm.tm_mon=((p[0]&0xf)*10)+(p[1]&0xf); - tm.tm_mday=((p[3]&0xf)*10)+(p[4]&0xf); } + tm.tm_mday=((p[3]&0xf)*10)+(p[4]&0xf); + } if (tm.tm_mon) tm.tm_mon--; /* zero-based month field */ tm.tm_isdst=-1; /* Do not adjust for DST */ @@ -106,7 +108,8 @@ char* DLLCALL unixtodstr(scfg_t* cfg, ti } if(tm.tm_mon>11) { /* DOS leap year bug */ tm.tm_mon=0; - tm.tm_year++; } + tm.tm_year++; + } if(tm.tm_mday>31) tm.tm_mday=1; if(cfg->sys_misc&SM_EURODATE) @@ -114,7 +117,8 @@ char* DLLCALL unixtodstr(scfg_t* cfg, ti ,TM_YEAR(tm.tm_year)); else sprintf(str,"%02u/%02u/%02u",tm.tm_mon+1,tm.tm_mday - ,TM_YEAR(tm.tm_year)); } + ,TM_YEAR(tm.tm_year)); + } return(str); } @@ -150,13 +154,13 @@ char* DLLCALL hhmmtostr(scfg_t* cfg, str /* Generates a 24 character ASCII string that represents the time_t pointer */ /* Used as a replacement for ctime() */ /****************************************************************************/ -char* DLLCALL timestr(scfg_t* cfg, time_t *intime, char* str) +char* DLLCALL timestr(scfg_t* cfg, time_t intime, char* str) { char* mer; uchar hour; struct tm tm; - if(localtime_r(intime,&tm)==NULL) { + if(localtime_r(&intime,&tm)==NULL) { strcpy(str,"Invalid Time"); return(str); }