Eliminate localtime calls, various cleanups

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-03-31 03:19:34 +00:00
parent e6918cb42e
commit 9baba73625
11 changed files with 91 additions and 100 deletions

View File

@@ -324,19 +324,19 @@ void callerid_free(struct callerid_state *cid)
static int callerid_genmsg(char *msg, int size, char *number, char *name, int flags)
{
time_t t;
struct tm *tm;
struct tm tm;
char *ptr;
int res;
int i,x;
/* Get the time */
time(&t);
tm = localtime(&t);
localtime_r(&t,&tm);
ptr = msg;
/* Format time and message header */
res = snprintf(ptr, size, "\001\010%02d%02d%02d%02d", tm->tm_mon + 1,
tm->tm_mday, tm->tm_hour, tm->tm_min);
res = snprintf(ptr, size, "\001\010%02d%02d%02d%02d", tm.tm_mon + 1,
tm.tm_mday, tm.tm_hour, tm.tm_min);
size -= res;
ptr += res;
if (!number || !strlen(number) || (flags & CID_UNKNOWN_NUMBER)) {