remove GTimeVal following glib 2.61.2 deprecation

This commit is contained in:
ailin-nemui 2019-12-06 10:56:25 +01:00
commit 1cdb4bc311
14 changed files with 74 additions and 69 deletions

View file

@ -65,7 +65,7 @@ int command_hide_output;
the line had one or two command chars, and which one.. */
static const char *current_cmdline;
static GTimeVal time_command_last, time_command_now;
static gint64 time_command_last, time_command_now;
static int last_command_cmd, command_cmd;
/* SYNTAX: ECHO [-window <name>] [-level <level>] <text> */
@ -222,7 +222,7 @@ static void event_command(const char *data)
time_command_last = time_command_now;
last_command_cmd = command_cmd;
g_get_current_time(&time_command_now);
time_command_now = g_get_real_time();
command_cmd = *data != '\0' &&
strchr(settings_get_str("cmdchars"), *data) != NULL;
@ -271,7 +271,7 @@ static void event_default_command(const char *data, void *server,
/* maybe we're copy+pasting text? check how long it was since the
last line */
diff = get_timeval_diff(&time_command_now, &time_command_last);
diff = time_command_now - time_command_last;
if (item != NULL && !last_command_cmd && diff < PASTE_CHECK_SPEED) {
signal_emit("send text", 3, current_cmdline, active_win->active_server, active_win->active);
command_cmd = FALSE;
@ -334,7 +334,7 @@ void fe_core_commands_init(void)
command_hide_output = 0;
command_cmd = FALSE;
memset(&time_command_now, 0, sizeof(GTimeVal));
time_command_now = 0;
command_bind("echo", NULL, (SIGNAL_FUNC) cmd_echo);
command_bind("version", NULL, (SIGNAL_FUNC) cmd_version);

View file

@ -415,7 +415,7 @@ static void sig_server_lag_disconnected(SERVER_REC *server)
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_LAG_DISCONNECTED, server->connrec->address,
time(NULL)-server->lag_sent.tv_sec);
time(NULL)-(server->lag_sent / G_TIME_SPAN_SECOND));
}
static void sig_server_reconnect_removed(RECONNECT_REC *reconnect)

View file

@ -123,22 +123,23 @@ static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr,
const char *target)
{
GTimeVal tv, tv2;
gint64 tv, tv2;
long usecs;
g_return_if_fail(data != NULL);
if (sscanf(data, "%ld %ld", &tv2.tv_sec, &tv2.tv_usec) < 1) {
char *tmp = g_strconcat("PING ", data, NULL);
if (sscanf(data, "%ld %ld", &tv, &tv2) < 1) {
char *tmp = g_strconcat("PING ", data, NULL);
ctcp_default_reply(server, tmp, nick, addr, target);
g_free(tmp);
return;
}
g_get_current_time(&tv);
usecs = get_timeval_diff(&tv, &tv2);
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
IRCTXT_CTCP_PING_REPLY, nick, usecs/1000, usecs%1000);
tv2 += tv * G_TIME_SPAN_SECOND;
tv = g_get_real_time();
usecs = tv - tv2;
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND, usecs % G_TIME_SPAN_SECOND);
}
void fe_ctcp_init(void)