First, I installed the “tzdata” TCE extension, and ensured that it is loaded at boot. With my custom configuration of TinyCore, I did this by adding a “tzdata.tcz” line in the mod_lang.lst file, but the standard is to add this line to onboot.lst; whichever file you choose, it is in /etc/sysconfig/tcedir.

Next, I changed my Grub2 configuration to set the right time zone: “Europe/Paris”. Besides, I considered that my USB flash drive with TinyCore on it would get booted mostly on Windows computers, that is computers with a clock set to local time. But I added a boot option to switch to a configuration where the computer’s clock is set to UTC, for those cases when I boot TinyCore Linux on a pure-Linux computer. Considering the way I have Grub2 set up, here are the changes:

  • I appended my chosen time zone to my common options:
    set tcopt_common="lang=fr_FR.utf8 kmap=azerty/fr-latin1 showapps tz=Europe/Paris"
  • I added a variable for the choice between local time and UTC:
    set tcopt_clock="noutc"
  • I inserted this variable to the “linux” line of the main TinyCore “menuentry”:
    linux /.boot/corelnx/vmlinuz$tc_bits $tcopt_base $tcopt_common $tcopt_clock […]
  • I created a new Grub2 “menuentry” for changing the clock-mode variable:
    menuentry "- UTC internal clock (Linux)" {
    set tcopt_clock=""
    }

The deed is done… mostly. I found that TinyCore Linux’ system clock is not synchronized with the hardware clock according to the time zone, by default. To do this, I had to add that line to the /opt/bootlocal.sh file, preferably on top (not the first line, though):

if grep -q noutc /proc/cmdline; then
hwclock -s -l
else
hwclock -s -u
fi

Ensure the /opt/bootlocal.sh file is saved across reboots. As an alternative, you might want to configure NTP.