diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-14 21:50:40 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-14 21:50:40 +0000 |
commit | a45f0ce8a0fded7acff845122856b8b92e8a1e00 (patch) | |
tree | 970b4536445781a1e3046fb0f2fc3c1d10eab080 /main | |
parent | eaff648d9b225be366870aade0617c6d8ca2a121 (diff) |
use ast_localtime() in every place localtime_r() was being used
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@69392 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/asterisk.c | 4 | ||||
-rw-r--r-- | main/callerid.c | 2 | ||||
-rw-r--r-- | main/cdr.c | 3 | ||||
-rw-r--r-- | main/logger.c | 4 | ||||
-rw-r--r-- | main/pbx.c | 2 | ||||
-rw-r--r-- | main/say.c | 73 |
6 files changed, 53 insertions, 35 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 7eccefdbf..0c36fda6a 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1828,7 +1828,7 @@ static char *cli_prompt(EditLine *el) case 'd': /* date */ memset(&tm, 0, sizeof(tm)); time(&ts); - if (localtime_r(&ts, &tm)) { + if (ast_localtime(&ts, &tm, NULL)) { strftime(p, sizeof(prompt) - strlen(prompt), "%Y-%m-%d", &tm); } break; @@ -1888,7 +1888,7 @@ static char *cli_prompt(EditLine *el) case 't': /* time */ memset(&tm, 0, sizeof(tm)); time(&ts); - if (localtime_r(&ts, &tm)) { + if (ast_localtime(&ts, &tm, NULL)) { strftime(p, sizeof(prompt) - strlen(prompt), "%H:%M:%S", &tm); } break; diff --git a/main/callerid.c b/main/callerid.c index 901137348..dfb43c77b 100644 --- a/main/callerid.c +++ b/main/callerid.c @@ -720,7 +720,7 @@ static int callerid_genmsg(char *msg, int size, const char *number, const char * int i,x; /* Get the time */ time(&t); - localtime_r(&t,&tm); + ast_localtime(&t, &tm, NULL); ptr = msg; diff --git a/main/cdr.c b/main/cdr.c index ee0fb789e..baa1165f8 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -208,7 +208,8 @@ static void cdr_get_tv(struct timeval tv, const char *fmt, char *buf, int bufsiz time_t t = tv.tv_sec; if (t) { struct tm tm; - localtime_r(&t, &tm); + + ast_localtime(&t, &tm, NULL); strftime(buf, bufsize, fmt, &tm); } } diff --git a/main/logger.c b/main/logger.c index cacedee44..e2291d966 100644 --- a/main/logger.c +++ b/main/logger.c @@ -726,7 +726,7 @@ void ast_log(int level, const char *file, int line, const char *function, const return; time(&t); - localtime_r(&t, &tm); + ast_localtime(&t, &tm, NULL); strftime(date, sizeof(date), dateformat, &tm); AST_LIST_LOCK(&logchannels); @@ -860,7 +860,7 @@ void ast_verbose(const char *fmt, ...) char *datefmt; time(&t); - localtime_r(&t, &tm); + ast_localtime(&t, &tm, NULL); strftime(date, sizeof(date), dateformat, &tm); datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1); sprintf(datefmt, "[%s] %s", date, fmt); diff --git a/main/pbx.c b/main/pbx.c index 56e291175..73c80ee05 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -4232,7 +4232,7 @@ int ast_check_timing(const struct ast_timing *i) struct tm tm; time_t t = time(NULL); - localtime_r(&t,&tm); + ast_localtime(&t, &tm, NULL); /* If it's not the right month, return */ if (!(i->monthmask & (1 << tm.tm_mon))) diff --git a/main/say.c b/main/say.c index 4d05848d0..2c3937c76 100644 --- a/main/say.c +++ b/main/say.c @@ -2924,8 +2924,8 @@ int ast_say_date_pt(struct ast_channel *chan, time_t t, const char *ints, const struct tm tm; char fn[256]; int res = 0; - ast_localtime(&t,&tm,NULL); - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday); if (!res) res = wait_file(chan, ints, fn, lang); @@ -5480,7 +5480,8 @@ int ast_say_time_en(struct ast_channel *chan, time_t t, const char *ints, const struct tm tm; int res = 0; int hour, pm=0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); hour = tm.tm_hour; if (!hour) hour = 12; @@ -5526,7 +5527,8 @@ int ast_say_time_de(struct ast_channel *chan, time_t t, const char *ints, const { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); if (!res) res = ast_say_number(chan, tm.tm_hour, ints, lang, "n"); if (!res) @@ -5544,7 +5546,8 @@ int ast_say_time_fr(struct ast_channel *chan, time_t t, const char *ints, const { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_number(chan, tm.tm_hour, ints, lang, "f"); if (!res) @@ -5561,7 +5564,8 @@ int ast_say_time_nl(struct ast_channel *chan, time_t t, const char *ints, const { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); if (!res) res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL); if (!res) @@ -5580,7 +5584,8 @@ int ast_say_time_pt(struct ast_channel *chan, time_t t, const char *ints, const struct tm tm; int res = 0; int hour; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); hour = tm.tm_hour; if (!res) res = ast_say_number(chan, hour, ints, lang, "f"); @@ -5606,7 +5611,8 @@ int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, con { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_number(chan, tm.tm_hour, ints, lang, "f"); if (!res) { @@ -5635,7 +5641,8 @@ int ast_say_time_tw(struct ast_channel *chan, time_t t, const char *ints, const struct tm tm; int res = 0; int hour, pm=0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); hour = tm.tm_hour; if (!hour) hour = 12; @@ -5702,7 +5709,8 @@ int ast_say_datetime_en(struct ast_channel *chan, time_t t, const char *ints, co char fn[256]; int res = 0; int hour, pm=0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); if (!res) { snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday); res = ast_streamfile(chan, fn, lang); @@ -5765,7 +5773,8 @@ int ast_say_datetime_de(struct ast_channel *chan, time_t t, const char *ints, co { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_date(chan, t, ints, lang); if (!res) ast_say_time(chan, t, ints, lang); @@ -5779,7 +5788,8 @@ int ast_say_datetime_fr(struct ast_channel *chan, time_t t, const char *ints, co struct tm tm; char fn[256]; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); if (!res) res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL); @@ -5817,7 +5827,8 @@ int ast_say_datetime_nl(struct ast_channel *chan, time_t t, const char *ints, co { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_date(chan, t, ints, lang); if (!res) { res = ast_streamfile(chan, "digits/nl-om", lang); @@ -5836,7 +5847,8 @@ int ast_say_datetime_pt(struct ast_channel *chan, time_t t, const char *ints, co char fn[256]; int res = 0; int hour, pm=0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); if (!res) { snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday); res = ast_streamfile(chan, fn, lang); @@ -5899,7 +5911,8 @@ int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_date(chan, t, ints, lang); if (!res) res = ast_say_time(chan, t, ints, lang); @@ -5913,7 +5926,8 @@ int ast_say_datetime_tw(struct ast_channel *chan, time_t t, const char *ints, co char fn[256]; int res = 0; int hour, pm=0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); if (!res) res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL); if (!res) { @@ -5992,8 +6006,8 @@ int ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char time(&nowt); - localtime_r(&t,&tm); - localtime_r(&nowt,&now); + ast_localtime(&t, &tm, NULL); + ast_localtime(&nowt,&now, NULL); daydiff = now.tm_yday - tm.tm_yday; if ((daydiff < 0) || (daydiff > 6)) { /* Day of month and month */ @@ -6032,8 +6046,8 @@ int ast_say_datetime_from_now_fr(struct ast_channel *chan, time_t t, const char time(&nowt); - localtime_r(&t,&tm); - localtime_r(&nowt,&now); + ast_localtime(&t, &tm, NULL); + ast_localtime(&nowt, &now, NULL); daydiff = now.tm_yday - tm.tm_yday; if ((daydiff < 0) || (daydiff > 6)) { /* Day of month and month */ @@ -6072,8 +6086,8 @@ int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char time(&nowt); - localtime_r(&t,&tm); - localtime_r(&nowt,&now); + ast_localtime(&t, &tm, NULL); + ast_localtime(&nowt, &now, NULL); daydiff = now.tm_yday - tm.tm_yday; if ((daydiff < 0) || (daydiff > 6)) { /* Day of month and month */ @@ -6296,7 +6310,7 @@ static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, int res = 0; int hour, pm=0; - localtime_r(&t,&tm); + ast_localtime(&t, &tm, NULL); hour = tm.tm_hour; if (!hour) @@ -6341,7 +6355,8 @@ static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *i struct tm tm; char fn[256]; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); /* W E E K - D A Y */ @@ -6829,7 +6844,8 @@ static int ast_say_time_ge(struct ast_channel *chan, time_t t, const char *ints, { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_number(chan, tm.tm_hour, ints, lang, (char*)NULL); if (!res) { @@ -6859,7 +6875,8 @@ static int ast_say_datetime_ge(struct ast_channel *chan, time_t t, const char *i { struct tm tm; int res = 0; - localtime_r(&t,&tm); + + ast_localtime(&t, &tm, NULL); res = ast_say_date(chan, t, ints, lang); if (!res) ast_say_time(chan, t, ints, lang); @@ -6882,8 +6899,8 @@ static int ast_say_datetime_from_now_ge(struct ast_channel *chan, time_t t, cons time(&nowt); - localtime_r(&t,&tm); - localtime_r(&nowt,&now); + ast_localtime(&t, &tm, NULL); + ast_localtime(&nowt, &now, NULL); daydiff = now.tm_yday - tm.tm_yday; if ((daydiff < 0) || (daydiff > 6)) { /* Day of month and month */ |