diff options
author | Gerhard Brauer <gerbra@archlinux.de> | 2009-06-25 20:05:18 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-06-25 21:31:09 +0200 |
commit | 42742c4fa29c9a335f9b8ebfbc860590467b7c8e (patch) | |
tree | b7a0fef1554c66eccb8e08b6add9154973c6b278 /src/core/libs | |
parent | 174a6038d44468ca8e98f849024cdbb2ba7e2c01 (diff) |
Fixed timesetting for hwclock localtime users
When we set system time from the BIOS clock via hwclock we must honor
the timezone the user previous selected during interactive_time().
After boot we are in an UTC environment. If we now - for localtime
users - parse hwclcock value to systemtime, then we get later a false
systemtime when copying the TZ file to /etc/localtime. Changing
/etc/localtime always recalculate the time according to the timezone.
Signed-off-by: Gerhard Brauer <gerbra@archlinux.de>
Diffstat (limited to 'src/core/libs')
-rw-r--r-- | src/core/libs/lib-misc.sh | 9 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index 1e8df8e..aa00dc6 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -104,6 +104,7 @@ cleanup_runtime () # $1 UTC or localtime (hardwareclock) # $2 direction (systohc or hctosys) +# $3 selected TIMEZONE (optional) dohwclock() { # TODO: we probably only need to do this once and then actually use adjtime on next invocations infofy "Resetting hardware clock adjustment file" @@ -116,7 +117,11 @@ dohwclock() { if [ "$1" = "UTC" ]; then hwclock --$2 --utc else - hwclock --$2 --localtime + if [ ! "$3"x == "x" ]; then + local ret=$(TZ=$3 hwclock --$2 --localtime) # we need the subshell so that TZ does not set in this shell + else + hwclock --$2 --localtime + fi fi } @@ -124,4 +129,4 @@ target_configure_initial_keymap_font () { [ -n "$var_KEYMAP" ] && sed -i "s/^KEYMAP=.*/KEYMAP=\"$var_KEYMAP\"/" ${var_TARGET_DIR}/etc/rc.conf [ -n "$var_CONSOLEFONT" ] && sed -i "s/^CONSOLEFONT=.*/CONSOLEFONT=\"$var_CONSOLEFONT\"/" ${var_TARGET_DIR}/etc/rc.conf -}
\ No newline at end of file +} diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 812753e..ae3ccd2 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -106,8 +106,8 @@ interactive_time () { NEXTITEM= while true; do - dohwclock $HARDWARECLOCK hctosys - current=`date` + dohwclock $HARDWARECLOCK hctosys $TIMEZONE + current=$(TZ=$TIMEZONE date) default=no [ -n "$NEXTITEM" ] && default="$NEXTITEM" #TODO: only propose if network ok |