diff options
author | rbuj <[email protected]> | 2020-09-23 14:28:01 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-10-11 16:58:34 +0200 |
commit | fa5a999a57af3bfaa21d7dfcbffc2994f0fa3b5e (patch) | |
tree | 9ad4950384e6a9f93f8180c6539f01eca1efaa2c /plugins | |
parent | 5eab9b4929cbe5c0c4165078f0ba0930ea1d3088 (diff) | |
download | mate-sensors-applet-fa5a999a57af3bfaa21d7dfcbffc2994f0fa3b5e.tar.bz2 mate-sensors-applet-fa5a999a57af3bfaa21d7dfcbffc2994f0fa3b5e.tar.xz |
hddtemp & mbmon plugins: 'GTimeVal' is deprecated
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hddtemp/hddtemp-plugin.c | 10 | ||||
-rw-r--r-- | plugins/mbmon/mbmon-plugin.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/plugins/hddtemp/hddtemp-plugin.c b/plugins/hddtemp/hddtemp-plugin.c index 506491d..3df514b 100644 --- a/plugins/hddtemp/hddtemp-plugin.c +++ b/plugins/hddtemp/hddtemp-plugin.c @@ -67,19 +67,19 @@ static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) { gchar *pc; struct sockaddr_in address; - static GTimeVal previous_query_time; - GTimeVal current_query_time; + static gint64 previous_query_time; + gint64 current_query_time; if (first_run) { // initialise previous time - g_get_current_time(&previous_query_time); + previous_query_time = g_get_monotonic_time (); } - g_get_current_time(¤t_query_time); + current_query_time = g_get_monotonic_time (); /* only actually query if more than 60 seconds has elapsed as hddtemp daemon will only actually send a new value if is > 60 seconds */ - if (first_run || current_query_time.tv_sec - previous_query_time.tv_sec > 60) { + if (first_run || current_query_time - previous_query_time > G_TIME_SPAN_MINUTE) { previous_query_time = current_query_time; if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { diff --git a/plugins/mbmon/mbmon-plugin.c b/plugins/mbmon/mbmon-plugin.c index 0bd5ee2..5caa51b 100644 --- a/plugins/mbmon/mbmon-plugin.c +++ b/plugins/mbmon/mbmon-plugin.c @@ -62,20 +62,20 @@ static const gchar *mbmon_plugin_query_mbmon_daemon(GError **error) { struct sockaddr_in address; static char* buffer = NULL; - static GTimeVal previous_query_time; - GTimeVal current_query_time; + static gint64 previous_query_time; + gint64 current_query_time; if (NULL == buffer) { /* initialise buffer and current time */ buffer = g_new0(char, MBMON_OUTPUT_BUFFER_LENGTH); - g_get_current_time(&previous_query_time); + previous_query_time = g_get_monotonic_time (); first_run = TRUE; } - g_get_current_time(¤t_query_time); + current_query_time = g_get_monotonic_time (); /* only query if more than 2 seconds has elapsed, mbmon daemon will send a new value every 2 seconds */ - if (first_run || current_query_time.tv_sec - previous_query_time.tv_sec > 2) { + if (first_run || current_query_time - previous_query_time > 2 * G_TIME_SPAN_SECOND) { previous_query_time = current_query_time; if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { |