LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.

Notices


Reply
  Search this Thread
Old 05-20-2011, 05:57 AM   #1
schliz
LQ Newbie
 
Registered: May 2011
Posts: 8

Rep: Reputation: Disabled
Wrong time.


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
Code:
> hwclock -w
and HWC is in local time
Code:
> hwclock -l
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:
Code:
>reboot
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

Last edited by schliz; 05-23-2011 at 08:29 AM. Reason: change of style
 
Old 05-20-2011, 11:20 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
I have no idea about Angstrom, but on Fedora the hardware clock settings are in /etc/sysconfig/clock.
Mine are:

Code:
ZONE="America/New_York"
UTC=true
ARC=false
for you, the ZONE should be your timezone and UTC should be false.

The documentation recommends keeping hardware clock on UTC rather than local time because saving during summer time will fail if you reboot in the fall.
 
Old 05-22-2011, 08:03 AM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
schliz, (Last Activity: 05-20-11 05:57 AM)

Welcome to LQ. Hope your time here helps you as much as mine has helped me.

Please put code, command line output, config files, etc. inside [CODE] tags, aka "Code:" blocks.

It will make your posts easier to read, & that will get you more, faster, better answers. -- Help us help you.
BTW, You can edit your post to do this retroactively. Please do so ASAP.

Thank you, & again, welcome.

Last edited by archtoad6; 05-22-2011 at 08:05 AM.
 
Old 05-23-2011, 01:58 AM   #4
schliz
LQ Newbie
 
Registered: May 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank's for your reply.
First of all sorry for the style.

Second:
In Angstrom distribution there are only these two files for setting the time and date. (As I found out)
I tested already all possible combinations.
In Angstrom is no ARC flag as well.

Any ideas?
Thank you.

Georg
 
Old 05-23-2011, 04:11 AM   #5
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Don't apologize for the style, fix it.

Use the "Edit" button in the lower right corner of your post. You can then add the tags that will make your code appear in "Code:" blocks. If you click the "Go Advanced" button, you will be able to highlight a section of code & then click the "#" icon above the edit window instead of typing the tags.
 
Old 05-23-2011, 08:22 AM   #6
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Quote:
Originally Posted by schliz View Post
I have problems setting the time correctly.
I set hwclock:
-w Set hardware clock to system time
> hwclock -w
and HWC is in local time
> hwclock -l
Fri May 20 10:10:58 2011 0.000000 seconds
The hardware clock does not keep track of local timezone. That can be different for each user logged into the machine, so it is only a personal preference.

The hwclock -l line above is just reading the time. If you want to set the clock to local time you need to put the -l option on every call to hwclock (reading and writing).
Code:
hwclock -l -w
But as I posted before, you are better off with the hardware being UTC.
 
Old 06-07-2011, 04:15 AM   #7
schliz
LQ Newbie
 
Registered: May 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank's again for now I will do some tests.
G
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
syslog time wrong - but date returns the correct time? falc410 Linux - Newbie 7 04-05-2020 10:04 PM
Various clock issues: Clock shows wrong time only in Knoppmyth, & CMOS time change ? davidbix General 1 04-05-2006 09:58 PM
my time is wrong and calender is also wrong Paxmaster Linux - General 6 12-16-2004 12:46 AM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM
my time is wrong~~! yjwon6 Linux - Software 2 09-15-2003 03:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration