[prev in list] [next in list] [prev in thread] [next in thread] 

List:       util-linux-ng
Subject:    [PATCH 3/6] hwclock: update set_system_clock debugging
From:       J William Piggott <elseifthen () gmx ! com>
Date:       2017-08-19 0:20:57
Message-ID: 44227f4c-9c7b-eaf0-7901-e9eed54993ca () gmx ! com
[Download RAW message or body]


Update debug messages for a combined --systz and --hctosys in
the set_system_clock function.

New debug messages:

hwclock --test -D --systz --localtime
Calling settimeofday(NULL, 240) to warp System time.
Test mode: clock was not changed

hwclock --test -D --systz --utc
Calling settimeofday(NULL, 0) to lock the warp function.
Calling settimeofday(NULL, 240) to set the kernel timezone.
Test mode: clock was not changed

hwclock --test -D --hctosys --utc
Calling settimeofday(1502239269.733639, 240)
Test mode: clock was not changed

hwclock --test -D --hctosys --localtime
Calling settimeofday(NULL, 240) to set persistent_clock_is_local.
Calling settimeofday(1502253708.200200, 240)
Test mode: clock was not changed

Signed-off-by: J William Piggott <elseifthen@gmx.com>
---
 sys-utils/hwclock.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index ddd6413..0be9c2a 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -606,11 +606,24 @@ set_system_clock(const struct hwclock_control *ctl,
 #endif
 
 	if (ctl->debug) {
-		printf(_("Calling settimeofday:\n"));
-		printf(_("\ttv.tv_sec = %ld, tv.tv_usec = %ld\n"),
-		       newtime.tv_sec, newtime.tv_usec);
-		printf(_("\ttz.tz_minuteswest = %d\n"), minuteswest);
+		if (ctl->hctosys && !ctl->universal)
+			printf(_("Calling settimeofday(NULL, %d) to set "
+				 "persistent_clock_is_local.\n"), minuteswest);
+		if (ctl->systz && ctl->universal)
+			puts(_("Calling settimeofday(NULL, 0) "
+				"to lock the warp function."));
+		if (ctl->hctosys)
+			printf(_("Calling settimeofday(%ld.%06ld, %d)\n"),
+			       newtime.tv_sec, newtime.tv_usec, minuteswest);
+		else {
+			printf(_("Calling settimeofday(NULL, %d) "), minuteswest);
+			if (ctl->universal)
+				 puts(_("to set the kernel timezone."));
+			else
+				 puts(_("to warp System time."));
+		}
 	}
+
 	if (ctl->testing) {
 		printf(_
 		       ("Test mode: clock was not changed\n"));
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic