diff --git a/Jupiter/Functions.c b/Jupiter/Functions.c index 4b17f85..db679b8 100644 --- a/Jupiter/Functions.c +++ b/Jupiter/Functions.c @@ -542,15 +542,18 @@ char *makestr(const char *str) } char *getTime() +{ + return getTimeFormat("%a %b %d %H:%M:%S %Y %Z"); +} + +char *getTimeFormat(const char *format) { time_t rawtime = time(0); static char rtime[256]; - strftime(rtime, sizeof(rtime), "%a %b %d %H:%M:%S %Y %Z", localtime(&rawtime)); + strftime(rtime, sizeof(rtime), format, localtime(&rawtime)); return rtime; } - - /** Character to integer conversion table */ const unsigned char baseTable[] = diff --git a/Jupiter/Functions.h b/Jupiter/Functions.h index 66bf489..499121b 100644 --- a/Jupiter/Functions.h +++ b/Jupiter/Functions.h @@ -285,17 +285,27 @@ JUPITER_API bool containsSymbol(const char *str, char c); JUPITER_API char *makestr(const char *str); /** -* @brief returns the current time in a string format. +* @brief Returns the current time in a string format. * This will vary depending on locale. * Format: Day_of_week Month Day hh:mm:ss Year Timezone. * Example 1: Sun Aug 18 13:52:21 2013 EST * Example 2: Thu Nov 14 03:52:57 2013 Eastern Standard Time * Exmaple 3: Sun Nov 17 15:06:19 2013 Tokyo Standard Time +* This is the same as getTimeFormat("%a %b %d %H:%M:%S %Y %Z"). * * @return A string containing the time in the format specified above. */ JUPITER_API char *getTime(); +/** +* @brief Returns the current time in a string format, based on an input format. +* Format specifiers are the same as strftime(). +* +* @param format String denoting the desired format of the output string. +* @return A string containing the time in the format specified above. +*/ +JUPITER_API char *getTimeFormat(const char *format); + /** * @brief Gets the next power of 2 after a specified number. * diff --git a/Release/Jupiter.lib b/Release/Jupiter.lib index 85172ef..ddc126e 100644 Binary files a/Release/Jupiter.lib and b/Release/Jupiter.lib differ