diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-09 11:27:33 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-09 11:27:33 +0000 |
commit | 60b579f8305c98b0222923e196fe224eeb917dd2 (patch) | |
tree | c0f32993d3b71ec6dced5a9c7a058970408a07ae /say.c | |
parent | 9dbb8e70b4e42d1bfe2e2df7dab509e60a8e930a (diff) |
do not use a variable name that hides a useful library symbol (time())
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@26016 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'say.c')
-rw-r--r-- | say.c | 38 |
1 files changed, 18 insertions, 20 deletions
@@ -4656,13 +4656,13 @@ int ast_say_date_with_format_nl(struct ast_channel *chan, time_t time, const cha } /* Polish syntax */ -int ast_say_date_with_format_pl(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone) +int ast_say_date_with_format_pl(struct ast_channel *chan, time_t thetime, const char *ints, const char *lang, const char *format, const char *timezone) { struct tm tm; int res=0, offset, sndoffset; char sndfile[256], nextmsg[256]; - ast_localtime(&time,&tm,timezone); + ast_localtime(&thetime, &tm, timezone); for (offset = 0 ; format[offset] != '\0' ; offset++) { int remainder; @@ -4780,53 +4780,51 @@ int ast_say_date_with_format_pl(struct ast_channel *chan, time_t time, const cha case 'Q': /* Shorthand for "Today", "Yesterday", or AdBY */ { - struct timeval now; + time_t tv_sec = time(NULL); struct tm tmnow; time_t beg_today; - gettimeofday(&now, NULL); - ast_localtime(&now.tv_sec,&tmnow, timezone); + ast_localtime(&tv_sec,&tmnow, timezone); /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */ /* In any case, it saves not having to do ast_mktime() */ - beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec); - if (beg_today < time) { + beg_today = tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec); + if (beg_today < thetime) { /* Today */ res = wait_file(chan, ints, "digits/today", lang); - } else if (beg_today - 86400 < time) { + } else if (beg_today - 86400 < thetime) { /* Yesterday */ res = wait_file(chan, ints, "digits/yesterday", lang); } else { - res = ast_say_date_with_format(chan, time, ints, lang, "AdBY", timezone); + res = ast_say_date_with_format(chan, thetime, ints, lang, "AdBY", timezone); } } break; case 'q': /* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */ { - struct timeval now; + time_t tv_sec = time(NULL); struct tm tmnow; time_t beg_today; - gettimeofday(&now, NULL); - ast_localtime(&now.tv_sec, &tmnow, timezone); + ast_localtime(&tv_sec, &tmnow, timezone); /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */ /* In any case, it saves not having to do ast_mktime() */ - beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec); - if (beg_today < time) { + beg_today = tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec); + if (beg_today < thetime) { /* Today */ - } else if ((beg_today - 86400) < time) { + } else if ((beg_today - 86400) < thetime) { /* Yesterday */ res = wait_file(chan, ints, "digits/yesterday", lang); - } else if (beg_today - 86400 * 6 < time) { + } else if (beg_today - 86400 * 6 < thetime) { /* Within the last week */ - res = ast_say_date_with_format(chan, time, ints, lang, "A", timezone); + res = ast_say_date_with_format(chan, thetime, ints, lang, "A", timezone); } else { - res = ast_say_date_with_format(chan, time, ints, lang, "AdBY", timezone); + res = ast_say_date_with_format(chan, thetime, ints, lang, "AdBY", timezone); } } break; case 'R': - res = ast_say_date_with_format(chan, time, ints, lang, "HM", timezone); + res = ast_say_date_with_format(chan, thetime, ints, lang, "HM", timezone); break; case 'S': /* Seconds */ @@ -4852,7 +4850,7 @@ int ast_say_date_with_format_pl(struct ast_channel *chan, time_t time, const cha } break; case 'T': - res = ast_say_date_with_format(chan, time, ints, lang, "HMS", timezone); + res = ast_say_date_with_format(chan, thetime, ints, lang, "HMS", timezone); break; case ' ': case ' ': |