[PATCH 2/2] base-files: use hwclock --systz

Rosen Penev rosenp at gmail.com
Sun Aug 30 21:10:08 EDT 2020


The date -k patch is non standard and was removed.

Tested behavior to be identical with a simple C program:

 #define _GNU_SOURCE
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/time.h>
 #include <sys/syscall.h>

int main()
{
        struct timezone tt;
	struct timezone tz;

        int a = syscall(SYS_gettimeofday, NULL, &tt);
        int b = gettimeofday(NULL, &tz);
        printf("%d - %d, %d\n", a, tt.tz_minuteswest, tt.tz_dsttime);
        printf("%d - %d, %d\n", b, tz.tz_minuteswest, tz.tz_dsttime);
}

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/base-files/Makefile                | 2 +-
 package/base-files/files/etc/init.d/system | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 7eb3ac1868..2419849a44 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=227
+PKG_RELEASE:=228
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
diff --git a/package/base-files/files/etc/init.d/system b/package/base-files/files/etc/init.d/system
index 0e33c522b4..585eeeef7e 100755
--- a/package/base-files/files/etc/init.d/system
+++ b/package/base-files/files/etc/init.d/system
@@ -27,7 +27,7 @@ system_config() {
 		ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ
 
 	# apply timezone to kernel
-	busybox date -k
+	hwclock --systz
 }
 
 reload_service() {
-- 
2.26.2




More information about the openwrt-devel mailing list