1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-03 12:16:44 +02:00

simplify timeout function

This commit is contained in:
Jfreegman
2015-08-18 01:46:22 -04:00
committed by cnhenry
parent 271ca08eb2
commit ed0a4fb3b8
8 changed files with 21 additions and 27 deletions

View File

@ -763,9 +763,8 @@ static uint64_t last_bootstrap_time = 0;
static void do_bootstrap(Tox *m)
{
static int conn_err = 0;
uint64_t curtime = get_unix_time();
if (!timed_out(last_bootstrap_time, curtime, TRY_BOOTSTRAP_INTERVAL))
if (!timed_out(last_bootstrap_time, TRY_BOOTSTRAP_INTERVAL))
return;
if (tox_self_get_connection_status(m) != TOX_CONNECTION_NONE)
@ -774,7 +773,7 @@ static void do_bootstrap(Tox *m)
if (conn_err != 0)
return;
last_bootstrap_time = curtime;
last_bootstrap_time = get_unix_time();
conn_err = init_connection(m);
if (conn_err != 0)
@ -1202,7 +1201,7 @@ int main(int argc, char *argv[])
do_toxic(m, prompt);
uint64_t cur_time = get_unix_time();
if (timed_out(last_save, cur_time, AUTOSAVE_FREQ)) {
if (timed_out(last_save, AUTOSAVE_FREQ)) {
pthread_mutex_lock(&Winthread.lock);
if (store_data(m, DATA_FILE) != 0)
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, RED, "WARNING: Failed to save to data file");