mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
use functional form of time()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
10
app.c
10
app.c
@@ -549,8 +549,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
|||||||
sfmt[fmtcnt++] = ast_strdupa(fmt);
|
sfmt[fmtcnt++] = ast_strdupa(fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
time(&start);
|
end = start = time(NULL); /* pre-initialize end to be same as start in case we never get into loop */
|
||||||
end = start; /* pre-initialize end to be same as start in case we never get into loop */
|
|
||||||
for (x = 0; x < fmtcnt; x++) {
|
for (x = 0; x < fmtcnt; x++) {
|
||||||
others[x] = ast_writefile(prepend ? prependfile : recordfile, sfmt[x], comment, O_TRUNC, 0, 0700);
|
others[x] = ast_writefile(prepend ? prependfile : recordfile, sfmt[x], comment, O_TRUNC, 0, 0700);
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
@@ -670,7 +669,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxtime) {
|
if (maxtime) {
|
||||||
time(&end);
|
end = time(NULL);
|
||||||
if (maxtime < (end - start)) {
|
if (maxtime < (end - start)) {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Took too long, cutting it short...\n");
|
ast_verbose(VERBOSE_PREFIX_3 "Took too long, cutting it short...\n");
|
||||||
@@ -689,7 +688,8 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
|||||||
} else {
|
} else {
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
}
|
}
|
||||||
if (end == start) time(&end);
|
if (end == start)
|
||||||
|
end = time(NULL);
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", recordfile, sfmt[x]);
|
ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", recordfile, sfmt[x]);
|
||||||
}
|
}
|
||||||
@@ -931,7 +931,7 @@ enum AST_LOCK_RESULT ast_lock_path(const char *path)
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
snprintf(s, strlen(path) + 9, "%s/.lock", path);
|
snprintf(s, strlen(path) + 9, "%s/.lock", path);
|
||||||
time(&start);
|
start = time(NULL);
|
||||||
while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5))
|
while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5))
|
||||||
usleep(1);
|
usleep(1);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
Reference in New Issue
Block a user