1
00:00:06,700 --> 00:00:10,759
Okay, now that we know how time is
used on Linux, let's talk about some utilities.

2
00:00:11,300 --> 00:00:16,120
First there is the old utility date. You
can use it to check time and set

3
00:00:16,120 --> 00:00:20,940
time, display format and even to set
time. But it's not the most convenient utility.

4
00:00:21,750 --> 00:00:26,560
Hwclock manipulates the hardware time and that is
useful. Knowing that the software clock is based

5
00:00:26,560 --> 00:00:31,370
on the hardware clock, you might first
want to fix it in the hardware clock.

6
00:00:31,870 --> 00:00:35,390
And there is Time
datectl, which is the generic

7
00:00:35,390 --> 00:00:38,909
utility that allows you
to manage time related properties.

8
00:00:39,890 --> 00:00:40,850
Let's go
check it out.

9
00:00:41,409 --> 00:00:47,817
So here we have the date utility which
is showing the date in standard format. What I

10
00:00:47,817 --> 00:00:54,224
like about date is formatting options. So date
+% d percent m dash percent y for instance,

11
00:00:54,225 --> 00:01:00,632
which is showing the day in the month
and in the year. Make that an uppercase y

12
00:01:00,632 --> 00:01:07,040
and you have a four digit year and
make that an uppercase d and you have what?

13
00:01:07,180 --> 00:01:08,900
Well, you have
a different formatting.

14
00:01:09,420 --> 00:01:13,219
Now the date formatting is quite
convenient. Have a look at the man

15
00:01:13,219 --> 00:01:17,019
page if you want to display
your time in a certain format.

16
00:01:18,500 --> 00:01:22,969
But if you really want to set
the time, better go for time date ctl.

17
00:01:23,609 --> 00:01:26,760
You step completion and there you
can see all the different options.

18
00:01:27,480 --> 00:01:32,930
So let's do a time date CTL
show where we can see the current settings,

19
00:01:32,930 --> 00:01:38,380
including the time zone and the current
time that is set. And this current time

20
00:01:38,379 --> 00:01:43,829
accurately matches what we currently have.
So no need to use set time.

21
00:01:44,329 --> 00:01:50,780
I mean nowadays nobody is setting the time
anymore. You automatically get the time from the Internet.

22
00:01:51,719 --> 00:01:57,033
In rare situations where your hardware clock
is seriously off because of that, you

23
00:01:57,033 --> 00:02:02,346
can't synchronize your time with the Internet
anymore. You might want to use settime.

24
00:02:02,346 --> 00:02:07,659
Let me do something more interesting
like Time date ctl set time zone.

25
00:02:08,759 --> 00:02:13,814
You can use list time zones if
you don't know what exactly to use.

26
00:02:13,814 --> 00:02:18,870
But if you do know, then you
can set it to whatever you want.

27
00:02:19,379 --> 00:02:23,000
Like Africa, Lusaka. And look
at that, now we're in Lusaka.

28
00:02:23,939 --> 00:02:30,219
Do we see that in time date CTL show?
Yeah, we do. It's 2312 in Lusaka right now.

29
00:02:31,120 --> 00:02:36,730
And if that is not
what I want, well, let's

30
00:02:36,730 --> 00:02:42,340
get back to set
time zone America, Los Angeles.

31
00:02:43,800 --> 00:02:45,780
And it automatically
adjusts the time.

32
00:02:46,719 --> 00:02:50,879
One thing that you might be
interested in that is HW Clock.

33
00:02:51,550 --> 00:02:54,569
HW Clock has a
couple of useful options.

34
00:02:55,789 --> 00:02:57,210
Help is
showing these options.

35
00:02:57,990 --> 00:03:02,780
So what are the
options? Well, mainly it is

36
00:03:02,780 --> 00:03:07,569
about sys to HC
or HC to sys.

37
00:03:08,120 --> 00:03:14,482
When do you want to use it? Well, if
your hardware clock is off, then you can consider

38
00:03:14,482 --> 00:03:20,845
using timedatectl to set your software clock correctly and
then you are going to use HW clock minus

39
00:03:20,844 --> 00:03:27,207
minus sys to HC to push your software clock
to the hardware clock and then everything is all

40
00:03:27,207 --> 00:03:33,569
right and your system should be capable
of correctly doing an NTP time synchronization again.
