aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_agi.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-15 00:24:24 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-15 00:24:24 +0000
commit15db46a445a4d6d71993475369b4a4906861f362 (patch)
tree6572dc8ac1336a5e0c0859186138a5313e88bd85 /res/res_agi.c
parent69f7e69869d726709046bffd71fd109b7dc4560d (diff)
add API function for parsing strings to time_t (issue #6320, with mods)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@10105 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 85436a672..ef7576fcd 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -742,16 +742,13 @@ static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *ar
if (res == 1)
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
- if (res >= 0)
- return RESULT_SUCCESS;
- else
- return RESULT_FAILURE;
+ return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{
int res=0;
- long unixtime;
+ time_t unixtime;
char *format, *zone=NULL;
if (argc < 4)
@@ -770,19 +767,15 @@ static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, char
if (argc > 5 && !ast_strlen_zero(argv[5]))
zone = argv[5];
- if (sscanf(argv[2], "%ld", &unixtime) != 1)
+ if (ast_get_time_t(argv[2], &unixtime, 0))
return RESULT_SHOWUSAGE;
- res = ast_say_date_with_format(chan, (time_t) unixtime, argv[3], chan->language, format, zone);
+ res = ast_say_date_with_format(chan, unixtime, argv[3], chan->language, format, zone);
if (res == 1)
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
-
- if (res >= 0)
- return RESULT_SUCCESS;
- else
- return RESULT_FAILURE;
+ return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, char *argv[])