lk/basics/time.md

71 lines
1.1 KiB
Markdown
Raw Normal View History

2022-01-16 18:20:39 +00:00
---
title: "time"
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
# systemd
Set time to synchronize with an ntp server:
```bash
timedatectl set-ntp true
```
2020-01-02 00:04:35 +00:00
2022-01-26 21:29:48 +00:00
This info stays in `/usr/share/zoneinfo`.
2020-01-02 00:04:35 +00:00
# Local Time
Local time is kept in /etc/localtime.
According to Dave's LPIC guide, you can set the local time by making asymboling link from your timezone to /etc/localtime, as so:
```bash
sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
```
2020-01-02 00:04:35 +00:00
...however this produced the wrong time for me. Further, /etc/localtime produces an output with cat, while the zoneinfo files do not.
# Locale
See local time, language and character settings with:
```bash
locale
```
2020-01-02 00:04:35 +00:00
List available locales with:
```bash
locale -a
```
2020-01-02 00:04:35 +00:00
To see additional locales which are available (but not necessarily installed):
```bash
cat /usr/share/i18n/SUPPORTED
```
2020-01-02 00:04:35 +00:00
Set a supported locale with:
```bash
locale-gen pl_PL.UTF-8
```
2020-01-02 00:04:35 +00:00
Then set that language, with:
```bash
LANG=pl_PL.UTF-8
```
2020-01-02 00:04:35 +00:00
... then reboot.
# Network Time Protocol
2022-01-26 21:29:48 +00:00
Glimpse an overview with:
2020-01-02 00:04:35 +00:00
```bash
ntpq -p
```
2020-01-02 00:04:35 +00:00
2022-01-26 21:29:48 +00:00
Usually this is run as a service, so just start that service.
2020-01-02 00:04:35 +00:00