From f3d44bb5f33bf927ef62bb0e6223e8312b9c4358 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Mon, 30 Mar 2009 21:13:40 +0200 Subject: do hwclock (only) at the right time, optimize hwclock code, make UTC default (fixes FS#13752 - Make hwclock in UTC a "good idea" --- src/core/libs/lib-misc.sh | 19 ++++++++++--------- src/core/libs/lib-ui-interactive.sh | 5 ++--- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index 1acebac..e09f3c8 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -102,19 +102,20 @@ cleanup_runtime () } +# $1 UTC or localtime (hardwareclock) dohwclock() { - infofy "Syncing hardwareclock to systemclock ..." - if [ "$HARDWARECLOCK" = "UTC" ]; then - HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc" - else - HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime" - fi - + infofy "Resetting hardware clock adjustment file" [ ! -d /var/lib/hwclock ] && mkdir -p /var/lib/hwclock if [ ! -f /var/lib/hwclock/adjtime ]; then - echo "0.0 0 0.0" > /var/lib/hwclock/adjtime # what the hell is this for??? + echo "0.0 0 0.0" > /var/lib/hwclock/adjtime + fi + + infofy "Syncing hardwareclock to systemclock ..." + if [ "$1" = "UTC" ]; then + hwclock --utc + else + hwclock --localtime fi - hwclock $HWCLOCK_PARAMS #tpowa does it without, but i would add --noadjtime here } target_configure_initial_keymap_font () diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index cb80c11..129b2cd 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -77,17 +77,16 @@ interactive_timezone () { TIMEZONE=$ANSWER_TIMEZONE infofy "Setting Timezone to $TIMEZONE" [ -e /etc/localtime ] && rm -f /etc/localtime #why do we do this?? tpowa? - dohwclock } interactive_time () { # utc or localtime? - ask_option no "Clock configuration" "Is your hardware clock in UTC or local time?" required "UTC" " " "localtime" " " || return 1 + ask_option UTC "Clock configuration" "Is your hardware clock in UTC or local time? UTC is recommended" required "UTC" " " "localtime" " " || return 1 HARDWARECLOCK=$ANSWER_OPTION - dohwclock + dohwclock $HARDWARECLOCK if which ntpdate >/dev/null && ask_yesno "'ntpdate' was detected on your system.\n\nDo you want to use 'ntpdate' for syncing your clock,\nby using the internet clock pool?\n(You need a working internet connection for doing this!)" yes #TODO: only propose if network ok. then -- cgit v1.2.3-54-g00ecf