I have problems setting the time correctly.
I am working with Angstrom embedded linux, kernelversion 2.6.32 on an armv7l.
I am from Austria:
Standard time zone: UTC/GMT +1 hour
Daylight saving time: +1 hour
Current time zone offset: UTC/GMT +2 hours
Time zone abbreviation: CEST - Central European Summer Time
If I set my clock via ntp:
Code:
> ntpdate -u 4.2.2.2
20 May 10:10:01 ntpdate[4540]: step time server 4.2.2.2 offset 2.541686 sec
and I test via:
Code:
> date
Fri May 20 10:10:29 CEST 2011
time and timezone abbreviation is set correctly.
hwclock options:
-r Show hardware clock time
-s Set system time from hardware clock
-w Set hardware clock to system time
-u Hardware clock is in UTC
-l Hardware clock is in local time
-f FILE Use specified device (e.g. /dev/rtc2)
I set hwclock:
-w Set hardware clock to system time
and HWC is in local time
Fri May 20 10:10:58 2011 0.000000 seconds
For information: (I put in each file in /etc/init.d, /etc/rc6.d and /etc/rc0.d an echo echoing > echo "/path/filename started $(date)")
When I reboot the board:
Serial console output:
///////////////////
Code:
[ 270.107879] save exit: isCheckpointed 1
Broadcast message from root (ttyS2) (Fri May 20 10:12:58 2011):
The system is going down for reboot NOW!
INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
root@LT_F8DC7A004496:~# /init.d/rc started Fri May 20 09:12:58 BST 2011
/rc6.d/K09sshd started Fri May 20 09:12:58 BST 2011
Stopping OpenBSD Secure Shell server: sshdstopped /usr/sbin/sshd (pid 4004)
.
K09sshd start Fri May 20 09:12:58 BST 2011
Stopping OpenBSD Secure Shell server: sshdno /usr/sbin/sshd found; none killed
/rc6.d/K19avahi-daemon started Fri May 20 09:12:58 BST 2011
* Stopping Avahi mDNS/DNS-SD Daemon: avahi-daemon
[ ok ]
* Stopping Avahi mDNS/DNS-SD Daemon: avahi-daemon
*[fail]
/rc6.d/K20dbus-1 started Fri May 20 09:12:58 BST 2011
Stopping Hardware abstraction layer hald
Stopping system message bus: stopped process in pidfile '/var/run/dbus/pid' (pid 3971)
dbus.
Stopping Hardware abstraction layer hald
run-parts: /etc/dbus-1/event.d/20hal exited with code 1
/rc6.d/K20gpe-dm started Fri May 20 09:12:59 BST 2011
Stopping GPE display manager: gpe-dm
Stopping GPE display manager: gpe-dm
cat: can't open '/var/run/gpe-dm.pid': No such file or directory
sh: you need to specify whom to kill
/rc6.d/K20netplug started Fri May 20 09:12:59 BST 2011
Stopping network plug daemon: netplugd.
Stopping network plug daemon: /rc6.d/K20psplash started Fri May 20 09:12:59 BST 2011
/rc6.d/K20syslog started Fri May 20 09:12:59 BST 2011
Stopping syslogd/klogd: stopped syslogd (pid 4017)
stopped klogd (pid 4019)
done
Stopping syslogd/klogd: no syslogd found; none killed
/rc6.d/K30ntpdate started Fri May 20 09:12:59 BST 2011
/rc6.d/K40networking started Fri May 20 09:12:59 BST 2011
Deconfiguring network interfaces... done.
Deconfiguring network interfaces... ifdown: interface lo not configured
ifdown: interface eth0 not configured
done.
/rc6.d/S20sendsigs started Fri May 20 09:12:59 BST 2011
Sending all processes the TERM signal...
Sending all processes the KILL signal...
Sending all processes the TERM signal...
Sending all processes the KILL signal...
/rc6.d/S25save-rtc.sh started Fri May 20 09:13:09 BST 2011
/init.d/hwclock started Fri May 20 09:13:09 BST 2011
hwclock (stop|restart|reload|force-reload) started Fri May 20 09:13:10 BST 2011
Saving the System Clock time to the Hardware Clock...
hwclock -w --utc;# --systohc
Hardware Clock updated to Fri May 20 09:13:10 BST 2011.
S25save-rtc stop Fri May 20 09:13:10 BST 2011
S25save-rtc start Fri May 20 09:13:10 BST 2011
/init.d/hwclock started Fri May 20 09:13:10 BST 2011
hwclock (stop|restart|reload|force-reload) started Fri May 20 09:13:10 BST 2011
Saving the System Clock time to the Hardware Clock...
hwclock -w --utc;# --systohc
Hardware Clock updated to Fri May 20 09:13:10 BST 2011.
S25save-rtc stop Fri May 20 09:13:10 BST 2011
/rc6.d/S31umountnfs.sh started Fri May 20 09:13:10 BST 2011
Unmounting remote filesystems...
Unmounting remote filesystems...
/rc6.d/S32portmap started Fri May 20 09:13:10 BST 2011
Stopping portmap daemon: portmap.
Stopping portmap daemon: portmap.
/rc6.d/S40umountfs started Fri May 20 09:13:10 BST 2011
Deactivating swap...
Unmounting local filesystems...
mount: can't find /mnt/ram in /proc/mounts
umount: tmpfs busy - remounted read-only
umount: tmpfs busy - remounted read-only
umount: none busy - remounted read-only
umount: tmpfs busy - remounted read-only
[ 282.277587] save exit: isCheckpointed 1
mount: cannot read /proc/mounts: No such file or directory
Deactivating swap...
Unmounting local filesystems...
mount: cannot read /proc/mounts: No such file or directory
umount: can't open /proc/mounts
mount: cannot read /proc/mounts: No such file or directory
/rc6.d/S90reboot started Fri May 20 09:13:10 BST 2011
Rebooting...
///////////////////////
As you can see, the first script outputs already BST (British summer time) which isn't correct.
/init.d/rc started Fri May 20 09:12:58 BST 2011
After reboot if I test date:
Code:
> date
Fri May 20 10:17:11 CEST 2011
date and timezone abbreviation is correct.
but if I do the same:
Code:
> ntpdate -u 4.2.2.2
20 May 10:19:34 ntpdate[4542]: step time server 4.2.2.2 offset 0.748216 sec
> date
Fri May 20 10:19:48 CEST 2011
> hwclock -w
> hwclock -l
Fri May 20 10:20:06 2011 0.000000 seconds
unplug the power of the board and restart.
Code:
> date
date
Fri May 20 12:22:07 CEST 2011
I get an adjustment of +2.
My settings are as following:
/etc/default/rcS:
///////////////////////////////
Code:
#
# Defaults for the boot scripts in /etc/rcS.d
#
# Time files in /tmp are kept in days.
TMPTIME=0
# Set to yes if you want sulogin to be spawned on bootup
SULOGIN=no
# Set to no if you want to be able to login over telnet/rlogin
# before system startup is complete (as soon as inetd is started)
DELAYLOGIN=no
# Set UTC=yes if your system clock is set to UTC (GMT), and UTC=no if not.
UTC=yes #GM
#TZ=`cat /etc/timezone` #GM
# Set VERBOSE to "no" if you would like a more quiet bootup.
VERBOSE=yes
# Set EDITMOTD to "no" if you don't want /etc/motd to be editted automatically
EDITMOTD=no
# Whether to fsck root on boot
ENABLE_ROOTFS_FSCK=no
# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
FSCKFIX=yes
# Set TICKADJ to the correct tick value for this specific machine
#TICKADJ=10000
# Enable caching in populate-volatile.sh
VOLATILE_ENABLE_CACHE=yes
//////////////////////////////
/etc/profile
/////////////////////////////////
Code:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
PATH="/usr/local/bin:/usr/bin:/bin:/usr/chrome"
EDITOR="/bin/vi" # needed for packages like cron
test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.
if [ ! -e /etc/localtime ]; then
TZ="UTC" # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html
# for an explanation of how to set this to your local timezone.
else
TZ=`cat /etc/timezone` # [gm,dr] see: http://lists.linuxtogo.org/pipermail...ly/002408.html
fi
export TZ
if [ "`id -u`" -eq 0 ]; then
PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:
fi
if [ "$PS1" ]; then
# works for bash and ash (no other shells known to be in use here)
PS1='\u@\h:\w\$ '
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
umask 022
export http_proxy=
export no_proxy=
////////////////////////////////
I changed /etc/profile because of:
http://www.mail-archive.com/angstrom.../msg02281.html
/etc/timezone is no link! It contains the timezone:
Europe/Paris
TZ is set:
Code:
> echo $TZ
Europe/Paris
Why does it interprete the timezone in BST??
Thank you very much for your help.
Georg