Setting time, wi-fi

Kernels & Hardware, configuring network, installing services

Re: Setting time, wi-fi

Postby luiznetto » 2017-05-10 19:02

You're wrong, sir, the commands hwclock, hwclock -r, hwclock -- show and date all give the same output:
Code: Select all
root@debian-luiz-computer:/home/luiz# hwclock
Wed 10 May 2017 12:43:22 PM PDT  -0.297209 seconds
root@debian-luiz-computer:/home/luiz# su luiz
luiz@debian-luiz-computer:~$ date
Wed May 10 12:43:46 PDT 2017
luiznetto
 
Posts: 39
Joined: 2013-11-26 18:40

Re: Setting time, wi-fi

Postby luiznetto » 2017-05-10 19:13

This is a little bit confusing, isn't it? I know that my hardware clock shows something different from the time where I am now (San Francisco), and it probably shows utc, but what if there was a difference between what my hardware clock shows and utc? What if my hardware clock was set by someone to the time in Paris or Moscow? The man pages for both date and hwclock are not very clear. I wish they stated clearly, this command shows what is in your BIOS clock. Period. Nothing more than that.
luiznetto
 
Posts: 39
Joined: 2013-11-26 18:40

Re: Setting time, wi-fi

Postby luiznetto » 2017-05-10 19:26

Here is the man page for hwclock:
Code: Select all
NAME
       hwclock - query or set the hardware clock (RTC)

SYNOPSIS
       hwclock [function] [option...]

DESCRIPTION
       hwclock  is a tool for accessing the Hardware Clock.  You can display the current time, set the Hardware
       Clock to a specified time, set the Hardware Clock from the System Time, or set the System Time from  the
       Hardware Clock.

       You  can also run hwclock periodically to add or subtract time from the Hardware Clock to compensate for
       systematic drift (where the clock consistently loses or gains time at a certain rate when left to run).

FUNCTIONS
       You need exactly one of the following options to tell hwclock what function to perform:

       -r, --show
              Read the Hardware Clock and print the time on standard output.  The time shown is always in local
              time,  even if you keep your Hardware Clock in Coordinated Universal Time.  See the --utc option.
              Showing the Hardware Clock time is the default when no function is specified.

The time shown is always in local
time, even if you keep your Hardware Clock in Coordinated Universal Time
luiznetto
 
Posts: 39
Joined: 2013-11-26 18:40

Re: Setting time, wi-fi

Postby GarryRicketson » 2017-05-10 21:33

The instructions are not confusing here,: http://www.thegeekstuff.com/2013/08/hwclock-examples/?utm_source=tuicool
and it says very clearly :
This is the same date and time that you’ll see from the BIOS screen.

from : http://www.thegeekstuff.com/2013/08/hwclock-examples/?utm_source=tuicool
This is the same date and time that you’ll see from the BIOS screen.


1. Display Hardware Clock Date and Time

Just type hwclock, which will display the date and time of your system’s hardware clock. This is the same date and time that you’ll see from the BIOS screen. You can also use option -r, or –show to display the date and time.


It does also go on to say:
Note: The output of the date command might be same as the output of the hwclock command (actually it should be the same). But, the date command gets the date and time from the clock managed from Linux kernel. This in example, there is around 10 mins difference between them.

So yes, they might be the same, in fact they should be.
But if they are not, the same tutorial goes on to explain setting it properly.
The OP just needs to read it.
Postby luiznetto » 2017-05-10 13:13
This is a little bit confusing, isn't it?

Not really, it is pretty clear in the tutorial.

Re: Setting time, wi-fi

Postby Dai_trying » 2017-05-10 12:57
If you have your hardware clock set to UTC you can just date -u

This is correct, read the :
Code: Select all
man date

$ man date
DATE(1) General Commands Manual
-----snip--------------------
-u Display or set the date in UTC (Coordinated Universal) time.


Postby luiznetto » 2017-05-10 13:13
This is a little bit confusing, isn't it? I know that my hardware clock shows something different from the time where I am now (San Francisco), and it probably shows utc, but what if there was a difference between what my hardware clock shows and utc? What if my hardware clock was set by someone to the time in Paris or Moscow? The man pages for both date and hwclock are not very clear. I wish they stated clearly, this command shows what is in your BIOS clock. Period. Nothing more than that.

This is why the hardware should be set to UTC, you don't seem to be sure of this, and then proceed to throw in all kinds of "What if " things,...that is what is making it confusing, Why are you doing that ?
What if my hardware clock was set by someone to the time in Paris or Moscow?

Well simply set it to UTC. Stop making something confusing, when it really is simple.
User avatar
GarryRicketson
 
Posts: 4219
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Previous

Return to System configuration

Who is online

Users browsing this forum: No registered users and 15 guests

fashionable