aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-04-04 20:05:42 +0200
committerMax Kellermann <max@duempel.org>2012-04-04 20:05:48 +0200
commit712e3eb1201315ded996b3f004eb4c613e2cecdd (patch)
tree1723047b0fd2a94e585347d3598bdcfe26467999 /src/input
parenta2b5db00037bd4e0604643eaa67e7a0dd978bb8a (diff)
downloadmpd-712e3eb1201315ded996b3f004eb4c613e2cecdd.tar.gz
mpd-712e3eb1201315ded996b3f004eb4c613e2cecdd.tar.xz
mpd-712e3eb1201315ded996b3f004eb4c613e2cecdd.zip
input/curl: use g_source_get_time()
g_source_get_current_time() is deprecated since GLib 2.28. This patch adds a compatibility wrapper for older GLib versions to glib_compat.h.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/curl_input_plugin.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index 88a5556d2..3f191141e 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -161,7 +161,7 @@ static struct {
* The absolute time stamp when the timeout expires. This is
* used in the GSource method check().
*/
- GTimeVal absolute_timeout;
+ gint64 absolute_timeout;
#endif
} curl;
@@ -551,12 +551,9 @@ input_curl_source_prepare(G_GNUC_UNUSED GSource *source, gint *timeout_r)
long timeout2;
CURLMcode mcode = curl_multi_timeout(curl.multi, &timeout2);
if (mcode == CURLM_OK) {
- if (timeout2 >= 0) {
- g_source_get_current_time(source,
- &curl.absolute_timeout);
- g_time_val_add(&curl.absolute_timeout,
- timeout2 * 1000);
- }
+ if (timeout2 >= 0)
+ curl.absolute_timeout = g_source_get_time(source)
+ + timeout2 * 1000;
if (timeout2 >= 0 && timeout2 < 10)
/* CURL 7.21.1 likes to report "timeout=0",
@@ -590,11 +587,7 @@ input_curl_source_check(G_GNUC_UNUSED GSource *source)
curl_multi_perform(), even if there was no file
descriptor event */
- GTimeVal now;
- g_source_get_current_time(source, &now);
- if (now.tv_sec > curl.absolute_timeout.tv_sec ||
- (now.tv_sec == curl.absolute_timeout.tv_sec &&
- now.tv_usec >= curl.absolute_timeout.tv_usec))
+ if (g_source_get_time(source) >= curl.absolute_timeout)
return true;
}
#endif