- In this video, I want to explain time in Linux.
It all starts with hardware time.
Hardware time is a time that's kept
in the hardware clock,
that's on the motherboard of your computer.
When your computer is booting,
the only thing that it has is hardware time.
So then you boot your operating system
and your operating system needs system time
and the system time is obtained from the hardware time.
So that means that the hardware time is leading
and it's important that your hardware time is set all right.
Now, how can we manipulate that?
Well, in Linux, we have utilities,
we have hwclock,
hwclock is the utility
that you can use to manipulate the hardware time
and we have utilities like timedatectl,
which is a preferred utility for managing time
in the operating system right now.
if we have timedatectl,
why would you want to manage the hardware time as well?
Well, that is because the timedatectl utility writes here
and if you have a problem or a serious difference
between hardware time and operating system time,
the next time you reboot,
your operating system will have the wrong time available
and that is why hwclock is a very relevant utility.
You can even use hwclock to synchronize the time
between the hardware time and the system time
and that is pretty important
that you are doing that all right
because next, your operating system time
often is synchronizing using NTP, the Network Time Protocol
but NTP is synchronizing with external service
to make sure that you get the time from the internet
and that's only going to work out all right
if the differences falls within a tolerance of 1000 seconds.
So that means that if your operating system clock is off
by more than 1000 seconds,
because a problem in your hardware time,
you won't get any time synchronization
and time is very important for services on Linux
and that is why you better make sure
that it works right before you do anything else.