I apologise for the lengthy post - but timezone and system clock issues can be confusing and I would like to offer some thoughts, questions, and some tools to investigate the relationships between hardware time, system time, browser/server time and user timezone.
For a long time I have had issues with Puppy's system clock not matching the "timestamp" of my browser.
One impact of this is that sometimes my browser is unable to download email attachments from the server - and I see an error message saying that there is an "invalid token".
Maybe my timekeeping issues relate to the fact that I live close to the international date line - if my timezone shifts a little to the west my browser thinks I am moving closer to Australia and still happily downloads my email attachments. But if my browser timezone drifts an hour to the East it crosses the dateline and shifts me into an entirely different day - which upsets the email attachment server.
During Quicksetup I have two timezones applicable to me - Pacific,Auckland or GMT+12 Wellington,Fiji. In theory (my theory anyway...) these two timezones should be pretty much the same thing (at least in winter).
However, the last Puppy that correctly handled the GMT+12 Wellington timezone was Slacko 5.6 - a long time ago. Since then there have been a variety of mismatches between my bios (hardware,RTC) clock and my soft (system) clock as a result of timezone choice and other factors. Some of this is due to bugs in Puppy, some of it is due to my lack of knowledge, but I suspect that some is due to general misunderstanding around how Linux handles the PC hardware clock. And some of the browser/server issues are related to the different ways in which different browsers calculate the system time on the users machine. Chrome and Mozilla use different methodologies in the past and may still do.
So what goes on between my hardware clock and my software clock and timezone settings? How can I stabilise my system? What data can I find out?
(During my daily use and also during these tests i keep the Bios/RTC/Hardware clock set to my local time. ie: when the sun is about to reach its midday peak my hardware clock says 11.59am. True "local, physical, solar" time)
Firstly - what does my browser think the time is?
We can visit the following site to find out:
http://browserspy.dk/date.php
Here is a comparison (Using Tahr32) between what my browser thinks is different between the Pacific,Auckland timezone and the GMT+12 Wellington timezone.
.
Notice the differences in "TimeZone offset" and also note the difference between server time and my browser time (measured in seconds). I think this is what upsets my email server when I am set to GMT+12. (There should be no difference - or at least minimal difference between Auckland and Wellington/GMT+12 timezones)
So I decided to look more closely at what my software thinks about my hardware clock.
There seems to be a command "hwclock" with which we can interrogate the bios/RTC clock in the PC. Take care with this command as it is also able to change the bios clock settings.
Here is what I see when I boot into Pacific/Auckland time
Code: Select all
root# hwclock
Fri 04 Jun 2021 08:53:07 PM NZST -0.402524 seconds
And here is what I see when I set GMT+12:
Code: Select all
root# hwclock
Thu 03 Jun 2021 08:53:41 PM -12 -0.683680 seconds
But here is what my actual bios clock says during the boot process:
.
It's obvious that in this case hwclock is NOT showing me the real time that is ticking away at a hardware level.
So it seems that Linux does not really care what your bios clock says. It does not treat it as a fixed point in space/time.
I have seen much advice that it is useful to tell Puppy to use UTC - but that only seems like useful advice if your PC is always on the internet. These days there is a checkbox in the Quicksetup menu where we can force Puppy to use UTC. But what value is this for users not online? Is UTC necessary?
My assumption has been that if I leave UTC unticked then Puppy will assume that we are running with the hardware clock set to local "physical, solar" time.
Unfortunately that seems to NOT be the case. If we do not specifically force Linux to treat the hardware clock as either UTC or "Localtime" then it just flounders around ignoring the hardware clock and allowing software to do it's own thing.
Maybe the Quicksetup routine needs to have a "localtime" checkbox and the new user must be forced to decide which they want.
Here is an excerpt from the hwclock manual:
Options
The following options apply to most functions:
-u, --utc
--localtime
Indicates that the Hardware Clock is kept in Coordinated Universal Time or local time, respectively. It is your choice whether to keep your clock in UTC or local time, but nothing in the clock tells which you've chosen. So this option is how you give that information to hwclock.If you specify the wrong one of these options (or specify neither and take a wrong default), both setting and querying of the Hardware Clock will be messed up.
If you specify neither --utc nor --localtime , the default is whichever was specified the last time hwclock was used to set the clock (i.e. hwclock was successfully run with the --set, --systohc, or --adjust options), as recorded in the adjtime file. If the adjtime file doesn't exist, the default is local time.
Windows dual booters in particular may have problems with clock stability.
So what about timezone setting? This can obviously upset browser time and impact your connection to websites and email etc. Although browsers nowadays can increasingly use geolocation and other factors to confirm where you are and to sync you appropriately with servers.
One thing that can upset email servers is privacy settings in the browser. Here is one link that offers a piece of code that can be entered into Firefox devmode to analyse whether or not there is fingerprint rejection masking the timezone of the user:
https://support.mozilla.org/en-US/questions/1198372
Turns out this was one of the problems I had when testing the latest Slacko/Firefox combo even though I had never heard of fingerprint privacy options.
And should the tray clock popup correctly identify the timezone? If I select GMT+12 my tray clock says -12:
.
So here is what I think my problems have been:
1) I assumed that Linux cared deeply about the hardware clock. It doesn't. It is my responsibility to tell Puppy to reference my hardware clock as localtime if that is what I want.
2) Some (many) Puppys have incorrect GMT timezone data in the zoneinfo Etc files. It seems that hwclock adds the timezone data on to the bios clock value to determine system time. If the timezone file is wrong then our system clock is wrong - regardless of the accurate setting of the hardware clock.
3) The timezone reflected when I hover over my tray clock should match with my timezone choice. If I choose GMT+12 in quicksetup then the tray clock popup should reflect that. If it shows "-" instead of "+" then either i have chosen the wrong timezone, or the zoneinfo/Etc timezone file is wrong, or there is some coding somewhere that is mixing things up.
Keen to hear any info that advances my understanding...
EDITs :
The man for RTC includes more complex info which also talks about accessing data from the "first read" of the rtc by using the command cat /proc/driver/rtc. Here is some data from Slacko 8.2.1 I am trialling:
Code: Select all
~$ cat /proc/driver/rtc
rtc_time : 11:15:02
rtc_date : 2021-06-04
alrm_time : 08:53:42
alrm_date : 2021-07-04
alarm_IRQ : no
alrm_pending : no
update IRQ enabled : no
periodic IRQ enabled : no
periodic IRQ frequency : 1024
max user IRQ frequency : 64
24hr : yes
periodic_IRQ : no
update_IRQ : no
HPET_emulated : yes
BCD : yes
DST_enable : no
periodic_freq : 1024
batt_status : okay
~$
At least that command seems to know that it is morning - which hwclock does not:
Code: Select all
~$ hwclock
2021-06-04 23:21:34.310697+12:00
~$
Other good reading :
https://tldp.org/HOWTO/Clock-2.html