From: Chen Xiao <[email protected]> When executing hwclock, if neither -u nor -l is specified, the UTC setting will be determined based on the adjtime file. If the adjtime file is not found, it currently defaults to returning 0, indicating UTC is not used. However, according to https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/ hwclock/hwclock.c?id=7894bf0f08740f75610990a2ba76af7a7cbce61e, the correct behavior should be to default to using UTC if the adjtime file is not found.
Signed-off-by: Chen Xiao <[email protected]> --- libbb/rtc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libbb/rtc.c b/libbb/rtc.c index 54b52f23a..fad039aee 100644 --- a/libbb/rtc.c +++ b/libbb/rtc.c @@ -9,15 +9,15 @@ int FAST_FUNC rtc_adjtime_is_utc(void) { - int utc = 0; + int utc = 1; FILE *f = fopen_for_read(ADJTIME_PATH); if (f) { char buffer[128]; while (fgets(buffer, sizeof(buffer), f)) { - if (is_prefixed_with(buffer, "UTC")) { - utc = 1; + if (is_prefixed_with(buffer, "LOCAL")) { + utc = 0; break; } } -- 2.20.1 _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
