28th November 2022
Back when the UNIX Operating System was being developed, they needed a way to store date and time. A convenient method was selected: Simply count the number of seconds since midnight on the first of January, 1970. Add one to the counter every second, and you have the time. 1,234,567,890 seconds later it was 13th February of 2009, for example. As I write this in 2022, it is 1,669,674,102 seconds after the Epoch. These numbers are all quite manageable, although 32-bit systems will hit a limit in the year 2038, when 03:14:07 UTC on 19 January 2038 will roll-over back to 1st January 1970 again. But that's a story for another day.
The system does allow for times before 1970 - by using negative numbers, we can also count backwards from the Epoch.
What confuses many people - certainly in Britain, is that GMT is normally the same as UTC. When us Brits were out spreading
universal love, joy and happiness around the globe (ahem), we of course declared that the time in Greenwich (London) was the definitive
time, and all other time zones must be defined relative to GMT. Later, international standardisation came up with Coordinated Universal Time
(UTC) as a more ISO-compliant kind of a name.
It did need to have its baseline somewhere, and GMT was used as that baseline. So us Brits have become used to GMT and UTC being the same thing.
We know that in Summer, our clocks go forward one hour for Daylight Savings, and that puts us into BST, or British Summer Time, aka UTC+1.
So the UNIX epoch of "zero" at midnight (UTC) on 1st January 1970 should show up as midnight on a UK-configured UNIX or Linux system
right? The "date -d @NNNN
" command (where "NNNN" is a number of seconds after the Epoch) displays the appropriate date:
$ date -d @0 Thu 1 Jan 01:00:00 BST 1970 $
Why does this claim that 1st January 1970 is BST? January is definitely not Summer in the UK!
In 1968, the UK Government conducted an experiment, whereby we spent all year one hour ahead. So it was BST all year round. This had the undesirable effect that winter mornings were very dark, particularly for Scottish farmers, and in 1971 the experiment was ended, reverting to the more usual "Spring Forward, Fall Back" mechanism of Daylight Savings.
So for those three years, the UK was (technically, at least) in a perpetual summer time, and any decent timekeeping system needs to be aware of odd political quirks such as this, when calculating relative times between regions.
My Shell Scripting books, available in Paperback and eBook formats. This tutorial is more of a general introduction to Shell Scripting, the longer Shell Scripting: Expert Recipes for Linux, Bash and more book covers every aspect of Bash in detail.
![]() Shell Scripting Tutorial is this tutorial, in 88-page Paperback and eBook formats. Convenient to read on the go, and in paperback format good to keep by your desk as an ever-present companion. Also available in PDF form from Gumroad:Get this tutorial as a PDF | ![]() Shell Scripting: Expert Recipes for Linux, Bash and more is my 564-page book on Shell Scripting. The first half covers all of the features of the shell in every detail; the second half has real-world shell scripts, organised by topic, along with detailed discussion of each script. |