lk/basics/clock.md

68 lines
1023 B
Markdown
Raw Normal View History

2022-01-16 18:20:39 +00:00
---
title: "clock"
2022-01-26 21:29:48 +00:00
tags: [ "Documentation", "Basics" ]
2022-01-16 18:20:39 +00:00
---
2020-01-02 00:04:35 +00:00
Show system time:
```bash
date
```
2020-01-02 00:04:35 +00:00
Show hardware time:
```bash
sudo hwclock -r
```
2020-01-02 00:04:35 +00:00
Change system time to match hardware time:
```bash
sudo hwclock --hctosys
```
2020-01-02 00:04:35 +00:00
Change hardware time to match system time:
```bash
sudo hwclock --systohc
```
2020-01-02 00:04:35 +00:00
Manually set the hardware time to a specified date:
```bash
sudo hwclock --set --date="8/25/19 13:30:00"
```
2020-01-02 00:04:35 +00:00
2020-01-10 04:19:29 +00:00
## Normal Date
```bash
date +%d/%m/%y
```
2020-01-10 04:19:29 +00:00
# Unix Time
Computers started counting time on January 1st, 1970, and added one second-per-second. If your clock shows you're in the 70's, it's reset to the start.
Track the time in Unix-time:
```bash
date +%s
```
2020-01-10 04:19:29 +00:00
2020-01-02 00:04:35 +00:00
# Network Time Providers
Servers which take their time from an observatory we call Stratum 1 servers. Servers which takes their time from Stratum n servers are Stratum n+1 servers.
Install ntp with:
```bash
sudo apt-get install -y ntp
```
2020-01-02 00:04:35 +00:00
The shell command for this is `ntpq`. Monitor the service providers using:
```bash
ntpq -p
```
2020-01-02 00:04:35 +00:00