From c5cd42b42dc70334f6065771fb43aa486f189394 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 23 Jan 2017 13:40:07 +0100 Subject: [PATCH] dsa-check-timedatectl: Work when the local timezone is not UTC --- dsa-nagios-checks/checks/dsa-check-timedatectl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsa-nagios-checks/checks/dsa-check-timedatectl b/dsa-nagios-checks/checks/dsa-check-timedatectl index 700d857..b3bc554 100755 --- a/dsa-nagios-checks/checks/dsa-check-timedatectl +++ b/dsa-nagios-checks/checks/dsa-check-timedatectl @@ -34,8 +34,8 @@ timedatectl > "$temp" ut=$(sed '/Universal time:/ { s/^[^:]*: *//; p}; d' "$temp") rtc=$(sed '/RTC time:/ { s/^[^:]*: *//; p}; d' "$temp") -uts=$(date -d "$ut" +%s) -rtcs=$(date -d "$rtc" +%s) +uts=$(TZ=UTC date -d "$ut" +%s) +rtcs=$(TZ=UTC date -d "$rtc" +%s) d=$((uts - rtcs)) -- 2.20.1