via: 526e6fe48cadc9418d64f2b639bad68d8883dcdd (commit)
from: 8c12162a9d92ceac55c6305f2336efcf7157b923 (commit)
= COMMIT LOG ===========================================================
committer: Anthony Minessale
comments:
FS-3038
diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c
index 807770a..f34042a 100644
--- a/src/mod/applications/mod_commands/mod_commands.c
+++ b/src/mod/applications/mod_commands/mod_commands.c
@@ -4439,19 +4439,23 @@ SWITCH_STANDARD_API(strftime_tz_api_function)
if ((format = strchr(mycmd, ' '))) {
*format++ = '\0';
- }
- if ((p = strchr(format, '|'))) {
- *p++ = '\0';
- when = atol(format);
- format = p;
+ if (format && (p = strchr(format, '|'))) {
+ *p++ = '\0';
+ when = atol(format);
+ format = p;
+ }
}
}
- if (switch_strftime_tz(tz_name, format, date, sizeof(date), when * 1000000) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */
+ if (zstr(format)) {
+ format = "%Y-%m-%d";
+ }
+
+ if (format && switch_strftime_tz(tz_name, format, date, sizeof(date), when * 1000000) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */
stream->write_function(stream, "%s", date);
} else {
- stream->write_function(stream, "-ERR Invalid Timezone\n");
+ stream->write_function(stream, "-ERR Invalid Timezone/Format\n");
}
switch_safe_free(mycmd);
Summary of changes: src/mod/applications/mod_commands/mod_commands.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630
--
FreeSWITCH Source