diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c index a62e334caa86128600f09fa3adadb625e8a65626..76aca26ba263a0262e779b9b07b8092757236709 100644 --- a/src/sbbs3/userdat.c +++ b/src/sbbs3/userdat.c @@ -572,8 +572,7 @@ static char* format_datetime(time_t t, char* str, size_t size) if(t == 0) *str = '\0'; else - safe_snprintf(str, size, "%" PRIu32 "T%06" PRIu32 "Z" - ,gmtime_to_isoDate(t), gmtime_to_isoTime(t)); + gmtime_to_isoDateTimeStr(t, str, size); return str; } diff --git a/src/xpdev/xpdatetime.c b/src/xpdev/xpdatetime.c index e27df4019f034d8cb8565666c0e2fc27d7062222..56f3faf974575ba0ae726aa5a95c303ee6932694 100644 --- a/src/xpdev/xpdatetime.c +++ b/src/xpdev/xpdatetime.c @@ -1,9 +1,5 @@ -/* xpdatetime.c */ - /* Cross-platform (and eXtra Precision) date/time functions */ -/* $Id: xpdatetime.c,v 1.13 2015/11/25 07:27:07 sbbs Exp $ */ - /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * @@ -17,21 +13,9 @@ * See the GNU Lesser General Public License for more details: lgpl.txt or * * http://www.fsf.org/copyleft/lesser.html * * * - * Anonymous FTP access to the most recent released source is available at * - * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * - * * - * Anonymous CVS access to the development source and modification history * - * is available at cvs.synchro.net:/cvsroot/sbbs, example: * - * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login * - * (just hit return, no password is necessary) * - * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src * - * * * For Synchronet coding style and modification guidelines, see * * http://www.synchro.net/source.html * * * - * You are encouraged to submit any modifications (preferably in Unix diff * - * format) via e-mail to mods@synchro.net * - * * * Note: If this box doesn't appear square, then you need to fix your tabs. * ****************************************************************************/ @@ -389,6 +373,20 @@ char* xpDateTime_to_isoDateTimeStr(xpDateTime_t dt return str; } +char* time_to_isoDateTimeStr(time_t t, xpTimeZone_t zone, char* str, size_t maxlen) +{ + snprintf(str, maxlen, "%" PRIu32 "T%06" PRIu32 "%d" + ,time_to_isoDate(t), time_to_isoTime(t), zone); + return str; +} + +char* gmtime_to_isoDateTimeStr(time_t t, char* str, size_t maxlen) +{ + snprintf(str, maxlen, "%" PRIu32 "T%06" PRIu32 "Z" + ,gmtime_to_isoDate(t), gmtime_to_isoTime(t)); + return str; +} + /****************************************************************************/ /* isoDate/Time/Zone String parsing functions */ /****************************************************************************/ diff --git a/src/xpdev/xpdatetime.h b/src/xpdev/xpdatetime.h index 74f91c2a76d1f34e0f483c66d197f7d9c1172ae3..e301ffcdadb00ad25595470bcf87d1cd13161865 100644 --- a/src/xpdev/xpdatetime.h +++ b/src/xpdev/xpdatetime.h @@ -138,6 +138,10 @@ DLLEXPORT char* xpDateTime_to_isoDateTimeStr(xpDateTime_t ,const char* date_sep, const char* datetime_sep, const char* time_sep ,int precision ,char* str, size_t maxlen); +DLLEXPORT char* time_to_isoDateTimeStr(time_t, xpTimeZone_t + ,char* str, size_t maxlen); +DLLEXPORT char* gmtime_to_isoDateTimeStr(time_t + ,char* str, size_t maxlen); #if defined(__cplusplus) }