Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on How to reset time in Ubuntu after replacing CMOS battery?

Parent

How to reset time in Ubuntu after replacing CMOS battery?

+2
−0

How to reset time in Ubuntu after replacing CMOS battery?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+2
−0

By default modern Ubuntu versions run the service systemd-timesyncd in the background. It fetches the time at regular intervals and should automatically set your system time when an NTP server is reachable.

Setting the time in Ubuntu manually

Since Ubuntu use systemd, the normal systemd procedure with timedatectl is used.

From man timedatectl:

set-time [TIME]
Set the system clock to the specified time. This will also update the RTC time accordingly. The time may be specified in the format "2012-10-30 18:17:16".

So, to set the time manually just run the command:

sudo timedatectl set-time "2025-01-07 18:17:16"

Setting the time automatically

I cant't find a concrete command to trigger an NTP sync, but restarting the systemd-timesyncd service should do the trick if you don't want to wait for the automatic sync.

sudo systemctl restart systemd-timesyncd
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Note that some NTP tools will only jump time less than 15 minutes. The manpage should tell you what `... (1 comment)
Note that some NTP tools will only jump time less than 15 minutes. The manpage should tell you what `...
polydact‭ wrote 4 days ago

Note that some NTP tools will only jump time less than 15 minutes. The manpage should tell you what systemd-timesyncd (sorry I did not look for you), but usually an explicit request to sync will cause a jump.

The purpose of not automatically jumping time more than 15 minutes is when something is already horribly wrong, e.g. bad timezone, jumping time can make it worse or cause other problems.

Also when time is quite close but not exact, NTP tools may choose to "slew" time by changing the effective local clock speed a little to get the system correct in a few hours. This is less invasive for small changes.