The manual page for hwclock (/sbin/hwclock) advises:ndrancs wrote:hi all,
i try to set the system time.
The following are some steps that I have done:
- Add a few lines of words in /etc/init.d/hwclock
As ndrancs has discovered the provided alphaOS defaults result in automatically altering the computer's Hardware Clock at shutdown since /etc/init.d/hwclock automatically executes /sbin/hwclock stop at that time. That is fine (and good) if the system clock has been correctly set up prior to shutdown, but I understand that that doesn't happen in alphaOS unless set up to do so via, as mentioned by simargl, an appropriate rdate command whilst connected to the Internet, which is problematic.The System Time is the time that matters. The Hardware Clock's basic purpose in a Linux system is to keep time when Linux is not running. You initialize the System Time to the time from the Hardware Clock when Linux starts up, and then never use the Hardware Clock again.
Standard Puppies, such as Puppy Slacko automatically initialise the system clock at boot time to the hardware clock in script rc.country, which is called by /etc/rc.d/rc.sysinit during boot. Something similar can be done in alphaOS as follows:
First, near the top of /etc/rc.d/rc.sysinit I have the following change to that which alphaOS provides by default:
Code: Select all
# Modified for alphaOS: http://sourceforge.net/projects/alphaos
. /etc/init.d/hwclock start # In alphaOS this line was originally . /etc/rc.conf
Second, I changed /etc/init.d/hwclock to the following:
Code: Select all
#!/bin/sh
#
# Written for alphaOS: http://sourceforge.net/projects/alphaos
# Author: archpup@gmail.com
#
# Distributed under the Creative Commons Attribution ShareAlike 3.0 Unported License.
# http://creativecommons.org/licenses/by-sa/3.0/
. /etc/rc.conf
case $HARDWARECLOCK in
UTC) HWCLOCK_PARAMS="--utc";;
localtime) HWCLOCK_PARAMS="--localtime";;
*) HWCLOCK_PARAMS="";;
esac
case "$1" in
start)
hwclock --hctosys $HWCLOCK_PARAMS # This initialises system clock
;;
stop)
# hwclock --adjust $HWCLOCK_PARAMS
hwclock --systohc $HWCLOCK_PARAMS
;;
esac
Code: Select all
ln -s /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
EDIT: I have commented out the hwclock --adjust line for the moment, because something still seems to be amiss and I suspect that... Will fix once I have time but currently busy eating ... :-)
EDIT2: Nope. Something remains faulty with the above. The rc.sysinit line for /etc/init.d/hwclock start doesn't seem to be doing the job (the line /etc/init.d/hwclock does indeed work if entered manually in a console later per ndrancs original post). Not sure what the problem is and run out of time this evening to look into this further sorry.