Timezones

From DSL Wiki

(By Robert Shingledecker)

Timezones should be working for many places in the US, Europe and Asia. If you live outside these, see below. If you don't do anything the default is US, Eastern Standard Time and setting your BIOS to local time is OK for most uses.

To see the supported zones take a peek at the subdirectories under:

       ls -l /usr/share/zoneinfo/

As of Jan 2007 (DSL 3.1) there are three subdirectories there: US, Europe, and Asia with about 30 supported zones. All US zones are supported. The list in 'Europe' appears to be comprehensive as far as I can tell. 'Asia' contains Jerusalem, Shanghai, Taipei, and Tokyo. The others have been cut for reasons of space.

Timezones are passed to dsl at the boot prompt, and consist of the appropriate subdirectory and zone file of the above-listed directory. For example: Europe/London, Asia/Taipei, or US/Pacific. The following is an example for US/Pacific.

Try this at the first boot prompt:

       dsl tz=US/Pacific

This will set the timezone to PST8PDT with an offset based on EST.

or use this

       dsl tz=US/Pacific utc

Then the offest will be based on the hardware, BIOS, clock set to UTC time.

If you remaster, you can easily add these boot options during the execution mkmydsl script, so that your "custom" cd won't require typing them in everytime.

For a frugal install, you can pass these options to dsl using the lilo, grub or gag bootloader. (For grub, edit the menu.lst file in /dev/hda5/boot/grub/ and add 'tz=Europe/Paris' (or whatever) to the DSL stanza(s) you boot from, and optionally 'utc' as well.)


Another useful command is 'date' which sets the system time

       date mmddhhmm (see date --help for all the options )

and then update the hardware clock with this command

       hwclock --systohc

Doing this you won't have to figure out the offsets.

You can query the hardware clock with this command:

       hwclock --show


The choice is yours on what time is to be stored in the BIOS hardware clock.

For additional information on how GNU/Linux systems manage time and timezones, see: http://www.debian.org/doc/manuals/system-administrator/ch-sysadmin-time.html (although not all of what you will see there applies to DSL).


Australia (and other places)


The default timezone database in Damn Small Linux is, well, damn small. I live in Australia. Here's what I did.

I happen to have a spare Linux computer lying around (Fedora Core 5). As far as I can tell, the timezone files are the same (YMMV). Just copy the relevant files. Here's what I did.

Using QEMU (virtualisation), I installed DSL to a USB stick as if it were a hard disk. I then booted off the resultant USB stick, again in QEMU; and started the ssh daemon.

On Fedora:

       scp -p /usr/share/zoneinfo/Australia/Melbourne dsl@192.168.0.25:/tmp

On DSL:

       mkdir /usr/share/zoneinfo/Australia
       mv /tmp/Melbourne /usr/share/zoneinfo/Australia
       mv /etc/localtime /etc/localtime.orig
       cp /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
       date 05201234