mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
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:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user