summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-08-29 18:17:27 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-08-29 18:17:27 +0200
commit7b546bea2e374a20c52ffd71de51f91eba07256d (patch)
treee743d06f609ab755d688d5b0cef80be14ac66b67 /src/plugins
parentddd829a1c707deb2ff1d4dfe2a5bd4ab09d048ba (diff)
downloadweechat-7b546bea2e374a20c52ffd71de51f91eba07256d.zip
api: use microseconds instead of milliseconds in functions util_timeval_diff and util_timeval_add
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-protocol.c4
-rw-r--r--src/plugins/irc/irc-server.c4
-rw-r--r--src/plugins/relay/weechat/relay-weechat-msg.c6
-rw-r--r--src/plugins/weechat-plugin.h6
4 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index fcf25d05b..3c15d614d 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -1633,8 +1633,8 @@ IRC_PROTOCOL_CALLBACK(pong)
/* calculate lag (time diff with lag check) */
old_lag = server->lag;
gettimeofday (&tv, NULL);
- server->lag = (int) weechat_util_timeval_diff (&(server->lag_check_time),
- &tv);
+ server->lag = (int)(weechat_util_timeval_diff (&(server->lag_check_time),
+ &tv) / 1000);
if (old_lag != server->lag)
weechat_bar_item_update ("lag");
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 5f8418b61..d954b79e3 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -2898,8 +2898,8 @@ irc_server_timer_cb (void *data, int remaining_calls)
if (ptr_server->lag_check_time.tv_sec != 0)
{
gettimeofday (&tv, NULL);
- ptr_server->lag = (int) weechat_util_timeval_diff (&(ptr_server->lag_check_time),
- &tv);
+ ptr_server->lag = (int)(weechat_util_timeval_diff (&(ptr_server->lag_check_time),
+ &tv) / 1000);
/* refresh lag item if needed */
if (((ptr_server->lag_last_refresh == 0)
|| (current_time >= ptr_server->lag_last_refresh + weechat_config_integer (irc_config_network_lag_refresh_interval)))
diff --git a/src/plugins/relay/weechat/relay-weechat-msg.c b/src/plugins/relay/weechat/relay-weechat-msg.c
index a7be45f2c..4fc601440 100644
--- a/src/plugins/relay/weechat/relay-weechat-msg.c
+++ b/src/plugins/relay/weechat/relay-weechat-msg.c
@@ -1023,7 +1023,7 @@ relay_weechat_msg_send (struct t_relay_client *client,
Bytef *dest;
uLongf dest_size;
struct timeval tv1, tv2;
- long time_diff;
+ long long time_diff;
if (weechat_config_integer (relay_config_network_compression_level) > 0)
{
@@ -1049,11 +1049,11 @@ relay_weechat_msg_send (struct t_relay_client *client,
/* display message in raw buffer */
snprintf (raw_message, sizeof (raw_message),
- "obj: %d/%d bytes (%d%%, %ldms), id: %s",
+ "obj: %d/%d bytes (%d%%, %.2fms), id: %s",
(int)dest_size + 5,
msg->data_size,
100 - ((((int)dest_size + 5) * 100) / msg->data_size),
- time_diff,
+ ((float)time_diff) / 1000,
msg->id);
/* send compressed data */
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index ad619e9c2..f53283365 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -57,7 +57,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
-#define WEECHAT_PLUGIN_API_VERSION "20140802-01"
+#define WEECHAT_PLUGIN_API_VERSION "20140829-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -304,8 +304,8 @@ struct t_weechat_plugin
/* util */
int (*util_timeval_cmp) (struct timeval *tv1, struct timeval *tv2);
- long (*util_timeval_diff) (struct timeval *tv1, struct timeval *tv2);
- void (*util_timeval_add) (struct timeval *tv, long interval);
+ long long (*util_timeval_diff) (struct timeval *tv1, struct timeval *tv2);
+ void (*util_timeval_add) (struct timeval *tv, long long interval);
char *(*util_get_time_string) (const time_t *date);
int (*util_version_number) (const char *version);