Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting system/ rtc clock

50 views
Skip to first unread message

Richard Schires

unread,
Sep 18, 2022, 4:50:05 PM9/18/22
to
I've been searching for an answer and keep going in a circle.
I hope you can help or direct me to someone who can. I am new to Linux.
I am using an HP ML150 G2 to run a tabletop CNC mill. The software is LinuxCNC on Debian. The problem that I am trying to resolve is getting the system clock and CMOS clock to match. 
If I set the time in the CMOS, reboot, the system time is five hours off.
I can get the system clock set through the date command;
sudo date -s "D M Y H:M:S"
Problem is that resets the CMOS time way off.
I've tried using hwclock -w to write the system time to CMOS but doesn't work.
I know I could just keep the system time and ignore the CMOS time but should be able to get the two to match.
Would appreciate your help or direction.




David Wright

unread,
Sep 18, 2022, 5:10:05 PM9/18/22
to
On Sun 18 Sep 2022 at 15:31:49 (-0500), Richard Schires wrote:
> I've been searching for an answer and keep going in a circle.
> I hope you can help or direct me to someone who can. I am new to Linux.
> I am using an HP ML150 G2 to run a tabletop CNC mill. The software is
> LinuxCNC on Debian. The problem that I am trying to resolve is getting the
> system clock and CMOS clock to match.
> If I set the time in the CMOS, reboot, the system time is five hours off.
> I can get the system clock set through the date command;
> sudo date -s "D M Y H:M:S"
> Problem is that resets the CMOS time way off.

Yes, it sets it to UTC. If you can persuade yourself that running
the CMOS clock on UTC is sensible, then just stick with that.
It makes life a lot simpler (no clock changes in spring and fall).

> I've tried using hwclock -w to write the system time to CMOS but doesn't
> work.
> I know I could just keep the system time and ignore the CMOS time but
> should be able to get the two to match.
> Would appreciate your help or direction.

Or you might want to explain why the CMOS time needs to be Local time,
which gets adjusted whenever the clocks change or you travel.

Cheers,
David.

Rodrigo Cunha

unread,
Sep 18, 2022, 9:40:05 PM9/18/22
to
Set the other timezone, in debian.
Or set the timezone in the hp system, to your localtime.
--
Atenciosamente,
Rodrigo da Silva Cunha
São Gonçalo, RJ - Brasil

David

unread,
Sep 18, 2022, 11:10:06 PM9/18/22
to
On Mon, 19 Sept 2022 at 06:47, Richard Schires <rsch...@gmail.com> wrote:

> I've been searching for an answer and keep going in a circle.

Hi,

Are there any other operating systems or virtual machines active
on this machine? That can get tricky.

If there is only one, then it sounds like your timezone isn't
matching your expectations.

The easiest method is to configure hardware clock as UTC
and specify your timezone, because that avoids messing
around with the hardware clock every time that daylight saving
changes localtime changes, and avoids invalid/duplicate
timestamps.

The docs I would read to guide investigating this are
'man 8 hwclock'
and
https://wiki.archlinux.org/title/System_time

I would start by reading
https://wiki.debian.org/DateTime
but you might need more detail than it provides.

David Wright

unread,
Sep 18, 2022, 11:20:05 PM9/18/22
to
On Mon 19 Sep 2022 at 13:05:34 (+1000), David wrote:
> On Mon, 19 Sept 2022 at 06:47, Richard Schires <rsch...@gmail.com> wrote:
>
> > I've been searching for an answer and keep going in a circle.
>
> Are there any other operating systems or virtual machines active
> on this machine? That can get tricky.
>
> If there is only one, then it sounds like your timezone isn't
> matching your expectations.
>
> The easiest method is to configure hardware clock as UTC
> and specify your timezone, because that avoids messing
> around with the hardware clock every time that daylight saving
> changes localtime changes, and avoids invalid/duplicate
> timestamps.
>
> The docs I would read to guide investigating this are
> 'man 8 hwclock'
> and
> https://wiki.archlinux.org/title/System_time
>
> I would start by reading
> https://wiki.debian.org/DateTime
> but you might need more detail than it provides.

The OP's timezone is correct, -0500 currently, as provided by
America/Chicago. The disagreement is on whether the RTC is
running UTC or LOCAL. Currently, it's set to UTC. The critical
lines are:

> > > I can get the system clock set through the date command;
> > > sudo date -s "D M Y H:M:S"
> > > Problem is that resets the CMOS time way off.

So it comes down to persuading the OP that the CMOS time being
"way off", ie five hours ahead, is in fact sensible, correct,
and easier to live with. (The OP has not mentioned any other
OS as being installed, but that's not a showstopper either.)

Cheers,
David.

David

unread,
Sep 19, 2022, 12:00:05 AM9/19/22
to
Agree 100%. That's what my paragraph "The
easiest method .." was suggesting, and the remainder of my
message was links, because they said they had been
searching without success, so I offered what I would use
as reference docs.

If I had written "understanding" instead of "investigating"
in the next para then that might have been clearer.

Cheers.

Curt

unread,
Sep 19, 2022, 11:30:06 AM9/19/22
to
On 2022-09-18, Richard Schires <rsch...@gmail.com> wrote:
> The problem that I am trying to resolve is getting the
> system clock and CMOS clock to match.

Why is that a problem?
0 new messages