How (not) to set the time and date :)

How to do things, solutions, recipes, tutorials
Message
Author
GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#16 Post by GuestToo »

i just downloaded and installed my "Set Clock from the Internet" dotpup package, and it seems to work properly ... i clicked the Set Hardware Clock button and it did ... it might be necessary to reboot after changing the time zone

if you have Puppy 1.0.8, did you install MU's bugfix for the clock setting program?
http://dotpups.de/puppy-releases/1.0.8r1/bugfixes/

User avatar
Dyno Spoid
Posts: 37
Joined: Tue 05 Sep 2006, 14:39
Location: Milwaukee, Wisconsin, U.S.A.
Contact:

rdate and 'Set Clock from the Internet' problem

#17 Post by Dyno Spoid »

rdate can be automaticaly scheduled from a cron job if you have an always on Internet connection.

Set Clock from the Internet can be used if you don't have an always on Internet connection.

Both don't take Daylight Savings Time into consideration, so the clock will be off during DST. :(

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#18 Post by GuestToo »

i did not know whether the hardware clock would be adjusted by "another operating system" or not, so i assumed that Puppy is using local time and i assumed that the time zone would be set for your location and to take into account daylight saving or not

in other words, if you set the time zone to match the time offset for the time of year, it should always display the correct time

using UTC is simpler, but not if you dual boot

maybe there's a more automatic way to do it, that takes into account all of the factors

User avatar
Béèm
Posts: 513
Joined: Sun 16 Apr 2006, 16:18
Location: Brussels

#19 Post by Béèm »

I run Puppy 2.02-seamonkey with KDE 3.5.4
The timezone is UTC and I see no way to change that.
Apparently no other timezone is available in Control Center.
This results in the time displayed in the systray displayed 2 hours earlier as I am in GMT+2 (daylight saving included)

I hope someone knows how to set the clock display correct.
Puppy Linux 2.02 SMkey, KDE354mini, wine0.9.20, devx-qt-renamed.
Puppy Linux 2.10r1 SMkey, JWM, devx_qt_renamed_210, KDE355mini

User avatar
Dyno Spoid
Posts: 37
Joined: Tue 05 Sep 2006, 14:39
Location: Milwaukee, Wisconsin, U.S.A.
Contact:

rdate and 'Set Clock from the Internet' problem workaround

#20 Post by Dyno Spoid »

----- -----
SET THE SYSTEM TIME AUTOMATICALLY
----- -----
To set the system time on boot, edit /etc/rc.d/rc.local and add the following lines:
---
# to automatically set the time on boot, un-comment the next line
rdate -s time.nist.gov ; hwclock --systohc --localtime
# Note: A nearby time server address can be obtained from:
# http://ntp.isc.org/bin/view/Servers/Str ... imeServers
# Make sure to issue the rdate command on the command line before
# including it in the croncore file to ensure you can connect to the
# time server.
# Note: If you are configuring multiple machines, it's a good idea to
# configure one of them that's usually running as a local time server,
# and the others to look at the local time server.
---
NOTE: Although the following lines will set the time every four hours, it's still a good idea to set the system time as soon as the system starts. The system startup delay on Puppy Linux is minimal (about two seconds) if the time server can't be reached.

To update the clock, use a text editor to create 'croncore':
---
# use /bin/sh to run commands, no matter what /etc/passwd says
SHELL=/bin/sh

# Syntax: minute hour day-of-month month day-of-week command
# minute: Clock minutes must equal this for command to execute, 0 to 59
# hour: Use 24-hour format, from 0 to 23
# day-of-month: 3 is the third, etc., 1 to 31
# month: 1 to 12
# day-of-week: 0 to 7, both 0 and 7 are Sunday
# day-of-week is in addition to day-of-month, so: 00 3 1,15 * 5 command
# runs at 3 AM on the 1st and 15th of every month, plus every Friday.
# Example to back up the system at 5:45 PM the first of every month:
# 45 17 1 * * /mnt/home_office/core_commands/system_backup
# See crontab-5 for more information
#
#
# Set the time of day every 4 hours.
# Note: A nearby time server address can be obtained from:
# http://ntp.isc.org/bin/view/Servers/Str ... imeServers
# Make sure to issue the rdate command on the command line before
# including it in the croncore file to ensure you can connect to the
# time server.
# Note: If you are configuring multiple machines, it's a good idea to
# configure one of them that's usually running as a local time server,
# and the others to look at the local time server.
0 0-23/4 * * * rdate -s time.nist.gov ; hwclock --systohc --localtime
---
NOTE: Only the last line is needed.

Add in whatever commands are in the crontab file. Use 'crontab -l' to list the crontab contents. NOTE: 'crontab -e' is usually used to edit the crontab file, but it doesn't work in busybox.

Activate the croncore file: 'crontab croncore'
NOTE: This will overwrite the current crontab file, so make sure all relevent commands are added to croncore.

Start the cron daemon at boot so crontab is read by adding it to /etc/rc.d/rc.local:
---
# start the cron daemon
crond
---

To start the cron daemon immediately, type: crond

NOTE: rdate may not take Daylight Savings Time into consideration, so you may need to adjust your timezone by adding one hour during DST:
/Menu/Control Panel/Set timezone
Example: Central Time = GMT-6, choose GMT-5 during DST
- You will probably have to reboot for this to fully take effect.
- This should set the correct time in BIOS if you were previously having DST problems.
- This may affect other operating systems that take DST into account. Some operating systems (including some Linux configurations) require the BIOS clock to be at GMT, or at your timezone without accounting for DST, so there is no problem with timestamps during the change to/from DST. I haven't had any problems, but your milage may vary. I can say that Microsoft Windows has problems with timestamps on MS Windows file servers when 'Automatically adjust clock for DST' is not set on the workstation. :roll:
Last edited by Dyno Spoid on Tue 05 Sep 2006, 19:20, edited 3 times in total.

User avatar
Béèm
Posts: 513
Joined: Sun 16 Apr 2006, 16:18
Location: Brussels

Re: rdate and 'Set Clock from the Internet' problem workarou

#21 Post by Béèm »

Dyno Spoid wrote:----- -----

NOTE: rdate may not take Daylight Savings Time into consideration, so you may need to adjust your timezone by adding one hour during DST:
/Menu/Control Panel/Set timezone
Example: Central Time = GMT-6, choose GMT-5 during DST
- You will probably have to reboot for this to fully take effect.
- This should set the correct time in BIOS if you were previously having DST problems.
- This may affect other operating systems that take DST into account. Some operating systems (including some Linux configurations) require the BIOS clock to be at GMT, or at your timezone without accounting for DST, so there is no problem with timestamps during the change to/from DST. I haven't had any problems, but your milage may vary. I can say that Microsoft Windows has problems with timestamps on MS Windows file servers when 'Automatically adjust clock for DST' is not set on the workstation. :roll:
I don't have /menu/Control Panel/Set timezone.
I can do /menu/control center/system administration/set date&time but I have only UTC and the indication current local timezone :UTC (PUP)

However in another Linux distribution, PCLinuxOS, I can set the timezone to GMT+2
Also in Puppy JWM I can set the zimezon at GMT+2.
Puppy Linux 2.02 SMkey, KDE354mini, wine0.9.20, devx-qt-renamed.
Puppy Linux 2.10r1 SMkey, JWM, devx_qt_renamed_210, KDE355mini

User avatar
Dyno Spoid
Posts: 37
Joined: Tue 05 Sep 2006, 14:39
Location: Milwaukee, Wisconsin, U.S.A.
Contact:

rdate and 'Set Clock from the Internet' problem workaround

#22 Post by Dyno Spoid »

I updated my above post to include links to local second-tier time time servers, and to get time updates every 4 hours instead of every hour, which is more inline for home users. I run a fair-sized network, and timestamps are critical, so I still update the time every hour on one machine, the primary server. That server also runs a local time server, so all other machines look to it to update their clocks (also noted above). This keeps everyone in sync rather well.

As a note, Greenwich Mean Time (GMT) is now called Coordinated Universal Time (UTC).

The problem with Daylight Savings Time is actually not with rdate, but with Puppy Linux. rdate (on Puppy 2.02) does not take Daylight Savings Time into consideration if you're not using a Time Zone with DST enabled, so you may need to adjust your timezone by changing the timezone to a DST timezone.

Example: Central Standard Time is CST, Central Standard Daylight Savings Time is CDT (or CSST, depending on who named the timezone file).

Problem: Puppy doesn't work this way! Puppy doesn't use 'standard' time zone definitions.

Solution: Add one hour during DST, as stated in my previous post (using Xvesa). If this doesn't work you can edit /etc/TZ and set PUPx to the correct value. You'll need to reboot for everything to work properly.

Examples:
UTC-6 is PUP6, and with DST is PUP5
UTC-5 is PUP5, and with DST is PUP4
UTC+5 is PUP-5, and with DST is PUP-6
UTC+6 is PUP-6, and with DST is PUP-7

Notice the numbers in this example are in reverse of what you would normally expect (Puppy Linux version 2.02).

In Beem's case, the correct UTC is PUP-1, and with DST is PUP-2. /etc/TZ would therefore contain one line: PUP-2

8)
Last edited by Dyno Spoid on Tue 05 Sep 2006, 20:52, edited 1 time in total.

Auda
Posts: 131
Joined: Sun 08 May 2005, 20:08
Location: New Zealand ( Christchurchish )

#23 Post by Auda »

As a note, Greenwich Mean Time (GMT) is now called Universal Time (UTC).
Close but no cigar.
GMT is based on the rotation of the earth so that when the sun is overhead ( ie. midday ) the time is called 12:00.
UTC is based on the vibrations of an atom in an atomic clock and has to be adjusted all the time to keep it in line with the real world.
Since about 1970 ? around 1/2 a minute has had to been added to UTC to keep it in line.
So why do we use UTC rather than GMT ? Because its more accurate !
As a side note its interesting that we have gone from imperical forms of mesurement, feet, stones, gallons, GMT, gold and silver for money, to arbatory forms, metre, gram, litre, UTC, paper/electronic money, which have no relationship to normal every day life.

Auda

Auda
Posts: 131
Joined: Sun 08 May 2005, 20:08
Location: New Zealand ( Christchurchish )

#24 Post by Auda »

Deleted duplicate of above
Last edited by Auda on Tue 05 Sep 2006, 20:52, edited 1 time in total.

User avatar
Dyno Spoid
Posts: 37
Joined: Tue 05 Sep 2006, 14:39
Location: Milwaukee, Wisconsin, U.S.A.
Contact:

UTC

#25 Post by Dyno Spoid »

While that's somewhat off topic, it did prompt some information searching. http://en.wikipedia.org/wiki/UTC

The chart at the bottom shows my timezone (Central Standard Time (USA CST) is no longer GMT-6, but rather UTC-6, and I now have Central Daylight Time of UTC-5 instead of CDT (Central Daylight Time) or CSST (Central Standard daylight Savings Time). This suggests my workaround for Puppy Linux is actually the new way to set the correct time, and not a workaround at all, unfortunately. This implies that twice yearly every machine on the network will have to be restarted for the DST change, as every timezone will change also. (Remember some scheduling software looks at the timezone.) The upside is that the timezone configuration files won't have to be updated when DST start/end dates are changed.

In the end, it seems Beem's correct timezone is currently UTC+2, but will change to UTC+1 shortly.

User avatar
Béèm
Posts: 513
Joined: Sun 16 Apr 2006, 16:18
Location: Brussels

#26 Post by Béèm »

Hi everybody,
I don't get it.
TZ was at PUP-2 and my system time was ok, but in the stray -2 hours.
Reasoning that PUP = UTC I did put PUP+2 in TZ and when the stray was right my clock was -2.
Finaly I did put PUP and now my stray = clock and when creating a new file it's done at the same time.
When tryin PUP-2 or PUP+2 creating a file gave a difference also.
Every time I changed TZ I rebooted.

I just wonder what will happen if I go back to JWM or XP with my clock.
Puppy Linux 2.02 SMkey, KDE354mini, wine0.9.20, devx-qt-renamed.
Puppy Linux 2.10r1 SMkey, JWM, devx_qt_renamed_210, KDE355mini

User avatar
Béèm
Posts: 513
Joined: Sun 16 Apr 2006, 16:18
Location: Brussels

#27 Post by Béèm »

OK then.
Switched to JWM and stray = clock. (W)Oef.
Puppy Linux 2.02 SMkey, KDE354mini, wine0.9.20, devx-qt-renamed.
Puppy Linux 2.10r1 SMkey, JWM, devx_qt_renamed_210, KDE355mini

User avatar
Dyno Spoid
Posts: 37
Joined: Tue 05 Sep 2006, 14:39
Location: Milwaukee, Wisconsin, U.S.A.
Contact:

Window Manager Time Difference

#28 Post by Dyno Spoid »

It sounds like the OS (Puppy Linux) is setting the system clock to the UTC+2 correctly, which can be verified two ways:

1: Check the system clock (hardware) in BIOS
2: Check the OS clock (software) using 'date' after exiting the window manager

If both are not the same, that would be unusual.

If both are the same, which they should be, and the clock in your window manager shows something different, try opening a terminal window and issuing 'date'. If the time is now incorrect in the terminal window, your window manager is set to use the OS clock as if it were set to UTC, making a time zone difference for you, and is ignoring the /etc/TZ file. This could be because the file is usually /etc/timezone. You might solve this problem by creating a link from TZ to timezone (ln -s /etc/TZ /etc/timezone), although your window manager might not understand the TZ file.

If this doesn't work, you can try adjusting the time zone in the window manager either by menu (which you don't seem to have) or by configuration file. There must be a configuration setting somewhere telling the window manager to adjust by two hours.

If the time in the BIOS, OS, and terminal window all match, but your X clock does not, the clock software might have a configuration that is causing the problem.

User avatar
Béèm
Posts: 513
Joined: Sun 16 Apr 2006, 16:18
Location: Brussels

#29 Post by Béèm »

Thanks for the info.
Since I changed in TZ PUP-2 to PUP, the time in the command prompt (outside a WM tho), a terminal, creating a file and stray are the same.
On next boot I will verify in the bios.
So it looks good so far.
Puppy Linux 2.02 SMkey, KDE354mini, wine0.9.20, devx-qt-renamed.
Puppy Linux 2.10r1 SMkey, JWM, devx_qt_renamed_210, KDE355mini

marksouth2000
Posts: 622
Joined: Wed 05 Apr 2006, 20:43

#30 Post by marksouth2000 »

This discussion puzzles me. Don't computer people all just set all their clocks and watches to UTC and keep mental track of their timezone? This is easier on the brain than constantly resetting one's watch, especially when travelling across timezones.

An sntp daemon is still useful, though.

User avatar
Béèm
Posts: 513
Joined: Sun 16 Apr 2006, 16:18
Location: Brussels

#31 Post by Béèm »

@Marksouth,
As a computer user, I would like:
- to see my stray clock = wrist-watch
- not being flamed when answering a post which appears to others as being before the post I answer.
- same for e-mail date and time
- files being created at the time of my wris-watch

So when I travel across a time zone, I readjust my wrist-watch, I don't want to mentaly calculate the local time.

So I expect the PC to behave accordingly.

@all,
Verified my bios clock, it's set correctly
Being in XP now, the clock is still ok.

So I have no more worries.

Only this remark: in PCLinux's KDE things are easier, because when setting time and date there is the worldwide selection of timezones to select from.
Puppy Linux 2.02 SMkey, KDE354mini, wine0.9.20, devx-qt-renamed.
Puppy Linux 2.10r1 SMkey, JWM, devx_qt_renamed_210, KDE355mini

Post Reply