summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-02-26 11:25:22 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2016-02-26 11:28:49 +0100
commit6369641d6f594557114b78fe740544ecf69a6d37 (patch)
tree9970181e381ca65c923bec9ef8ab711b705eb397 /src/core
parent06fb28b16eb4b6170c2e2c0cf1f673730309509b (diff)
clock-util: make clock_is_localtime() testable and add initial tests
Add path argument to clock_is_localtime() and default to "/etc/adjtime" if it's NULL. This makes the function testable. Add test-clock: initial test cases for some scenarios, using a temporary file. This also checks the behaviour with a NULL (i. e. the system's /etc/adjtime) file.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-manager.c2
-rw-r--r--src/core/main.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index f939196397..00372b92b4 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -139,7 +139,7 @@ static int property_get_tainted(
if (access("/proc/cgroups", F_OK) < 0)
e = stpcpy(e, "cgroups-missing:");
- if (clock_is_localtime() > 0)
+ if (clock_is_localtime(NULL) > 0)
e = stpcpy(e, "local-hwclock:");
/* remove the last ':' */
diff --git a/src/core/main.c b/src/core/main.c
index b4e96fd6f4..2c315930ed 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1375,7 +1375,7 @@ int main(int argc, char *argv[]) {
}
if (!skip_setup) {
- if (clock_is_localtime() > 0) {
+ if (clock_is_localtime(NULL) > 0) {
int min;
/*