AU: Switch GLib's timeout sources from milliseconds to seconds.
There's no need for the extra resolution and seconds is preferred.
BUG=5577
TEST=unit tests, gmerged on device and saw checks at 2 and 30 minutes.
Change-Id: I6d64774d5a0e8961fbb9868edc42e62eb794ba11
Review URL: http://codereview.chromium.org/3183004
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 7bee4c1..0707d99 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -112,9 +112,9 @@
if (delegate_)
delegate_->TransferComplete(this, false); // success
} else {
- g_timeout_add(5 * 1000,
- &LibcurlHttpFetcher::StaticRetryTimeoutCallback,
- this);
+ g_timeout_add_seconds(5,
+ &LibcurlHttpFetcher::StaticRetryTimeoutCallback,
+ this);
}
return;
} else {
@@ -229,7 +229,7 @@
}
if (!timeout_source_) {
LOG(INFO) << "setting up timeout source:" << ms;
- timeout_source_ = g_timeout_source_new(1000);
+ timeout_source_ = g_timeout_source_new_seconds(1);
CHECK(timeout_source_);
g_source_set_callback(timeout_source_, StaticTimeoutCallback, this,
NULL);
diff --git a/main.cc b/main.cc
index c196ed5..3ae1e4b 100644
--- a/main.cc
+++ b/main.cc
@@ -60,8 +60,8 @@
// Kick off periodic updating. First, update after 2 minutes. Also, update
// every 30 minutes.
- g_timeout_add(2 * 60 * 1000, &UpdateOnce, update_attempter);
- g_timeout_add(30 * 60 * 1000, &UpdatePeriodically, update_attempter);
+ g_timeout_add_seconds(2 * 60, &UpdateOnce, update_attempter);
+ g_timeout_add_seconds(30 * 60, &UpdatePeriodically, update_attempter);
}
void SetupDbusService(UpdateEngineService* service) {