aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-14 22:09:20 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-14 22:09:20 +0000
commit4c5507d166332e73d2e7b63bd97a03c76172d923 (patch)
tree9bccdddefcc0defe7b34185794b77a9439806dcd /main
parent4293ad87778af581f153f9f651126de6a20e7704 (diff)
Merged revisions 69392 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r69392 | kpfleming | 2007-06-14 16:50:40 -0500 (Thu, 14 Jun 2007) | 2 lines use ast_localtime() in every place localtime_r() was being used ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69405 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c8
-rw-r--r--main/callerid.c2
-rw-r--r--main/cdr.c3
-rw-r--r--main/logger.c4
-rw-r--r--main/manager.c4
-rw-r--r--main/pbx.c2
-rw-r--r--main/say.c79
-rw-r--r--main/stdtime/localtime.c2
8 files changed, 62 insertions, 42 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 4f5ada9b0..2e469729b 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -365,11 +365,11 @@ static int handle_show_settings(int fd, int argc, char *argv[])
#if defined(HAVE_SYSINFO)
ast_cli(fd, " Min Free Memory: %ld MB\n", option_minmemfree);
#endif
- if (localtime_r(&ast_startuptime, &tm)) {
+ if (ast_localtime(&ast_startuptime, &tm, NULL)) {
strftime(buf, sizeof(buf), "%H:%M:%S", &tm);
ast_cli(fd, " Startup time: %s\n", buf);
}
- if (localtime_r(&ast_lastreloadtime, &tm)) {
+ if (ast_localtime(&ast_lastreloadtime, &tm, NULL)) {
strftime(buf, sizeof(buf), "%H:%M:%S", &tm);
ast_cli(fd, " Last reload time: %s\n", buf);
}
@@ -1864,7 +1864,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;
case 'h': /* hostname */
@@ -1921,7 +1921,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;
case '#': /* process console or remote? */
diff --git a/main/callerid.c b/main/callerid.c
index 55e20d3da..1401bbbd9 100644
--- a/main/callerid.c
+++ b/main/callerid.c
@@ -691,7 +691,7 @@ static int callerid_genmsg(char *msg, int size, const char *number, const char *
/* 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 6614604eb..deed01e3f 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -212,7 +212,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 e842c77bd..c64b634f4 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -931,7 +931,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
/* Create our date/time */
time(&t);
- localtime_r(&t, &tm);
+ ast_localtime(&t, &tm, NULL);
strftime(logmsg->date, sizeof(logmsg->date), dateformat, &tm);
/* Copy over data */
@@ -1022,7 +1022,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/manager.c b/main/manager.c
index 31df724d5..012400554 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -2290,9 +2290,9 @@ static int action_corestatus(struct mansession *s, const struct message *m)
if (!ast_strlen_zero(actionid))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
- localtime_r(&ast_startuptime, &tm);
+ ast_localtime(&ast_startuptime, &tm, NULL);
strftime(startuptime, sizeof(startuptime), "%H:%M:%S", &tm);
- localtime_r(&ast_lastreloadtime, &tm);
+ ast_localtime(&ast_lastreloadtime, &tm, NULL);
strftime(reloadtime, sizeof(reloadtime), "%H:%M:%S", &tm);
astman_append(s, "Response: Success\r\n"
diff --git a/main/pbx.c b/main/pbx.c
index dbd12039a..e01b7c9ad 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -4311,7 +4311,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 fcb066e5a..c11ac7218 100644
--- a/main/say.c
+++ b/main/say.c
@@ -3062,8 +3062,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);
@@ -5637,7 +5637,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;
@@ -5683,7 +5684,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)
@@ -5701,7 +5703,8 @@ int ast_say_time_hu(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)
@@ -5722,7 +5725,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)
@@ -5739,7 +5743,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)
@@ -5758,7 +5763,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");
@@ -5784,7 +5790,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) {
@@ -5813,7 +5820,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;
@@ -5882,7 +5890,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);
@@ -5945,7 +5954,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);
@@ -5958,7 +5968,8 @@ int ast_say_datetime_hu(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);
@@ -5971,7 +5982,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);
@@ -6009,7 +6021,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);
@@ -6028,7 +6041,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);
@@ -6091,7 +6105,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);
@@ -6105,7 +6120,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) {
@@ -6184,8 +6200,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 */
@@ -6224,8 +6240,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 */
@@ -6264,8 +6280,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 */
@@ -6489,7 +6505,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)
@@ -6534,7 +6550,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 */
@@ -7024,7 +7041,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) {
@@ -7054,7 +7072,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);
@@ -7077,8 +7096,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 */
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index e54f2affd..18cd3d7d8 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -1217,7 +1217,7 @@ const time_t * const timep;
char *buf;
{
struct tm tm;
- return asctime_r(localtime_r(timep, &tm), buf);
+ return asctime_r(ast_localtime(timep, &tm, NULL), buf);
}
/*