Verified Commit 34d920dc authored by Josef Schlehofer's avatar Josef Schlehofer 💬
Browse files

patches/openwrt: backport patch to use hwclock in base-files

parent 43b75d63
From bb5822954e45b7ff75d77ea38db4118a4144655f Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 31 Jan 2021 16:15:52 -0800
Subject: [PATCH] base-files: use hwclock --systz
The date -k patch is non standard and will be removed in the next
commit.
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@gmail.com>
(cherry picked from commit 157cd0bd97bcfec8a34d4ebb558f37bee4f0515f)
---
package/base-files/files/etc/init.d/system | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/base-files/files/etc/init.d/system b/package/base-files/files/etc/init.d/system
index a98a972469..08cf86b97f 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
- date -k
+ hwclock -u --systz
}
reload_service() {
--
2.25.1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment