add a library of timeval manipulation functions, and change a large number of usses to use the new functions (bug #4504)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-07-15 23:00:47 +00:00
parent 60cd1fa57d
commit 22b0f5d306
39 changed files with 420 additions and 635 deletions

View File

@@ -127,7 +127,6 @@ static char *acf_strftime(struct ast_channel *chan, char *cmd, char *data, char
{
char *format, *epoch, *timezone;
long epochi;
struct timeval tv;
struct tm time;
if (data) {
@@ -137,11 +136,9 @@ static char *acf_strftime(struct ast_channel *chan, char *cmd, char *data, char
timezone = strsep(&format, "|");
if (epoch && !ast_strlen_zero(epoch) && sscanf(epoch, "%ld", &epochi) == 1) {
} else if (!gettimeofday(&tv, NULL)) {
epochi = tv.tv_sec;
} else {
ast_log(LOG_ERROR, "Cannot gettimeofday() ?!!\n");
return "";
struct timeval tv = ast_tvnow();
epochi = tv.tv_sec;
}
ast_localtime(&epochi, &time, timezone);