mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 09:12:25 +00:00
FS-3038
This commit is contained in:
parent
8c12162a9d
commit
526e6fe48c
@ -4439,19 +4439,23 @@ SWITCH_STANDARD_API(strftime_tz_api_function)
|
|||||||
|
|
||||||
if ((format = strchr(mycmd, ' '))) {
|
if ((format = strchr(mycmd, ' '))) {
|
||||||
*format++ = '\0';
|
*format++ = '\0';
|
||||||
}
|
|
||||||
|
|
||||||
if ((p = strchr(format, '|'))) {
|
if (format && (p = strchr(format, '|'))) {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
when = atol(format);
|
when = atol(format);
|
||||||
format = p;
|
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);
|
stream->write_function(stream, "%s", date);
|
||||||
} else {
|
} else {
|
||||||
stream->write_function(stream, "-ERR Invalid Timezone\n");
|
stream->write_function(stream, "-ERR Invalid Timezone/Format\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_safe_free(mycmd);
|
switch_safe_free(mycmd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user