Skip to main content

UNIX time from NTP or short UtfN is a simple CLI tool to set the time from an NTP-Server.

Project description

UNIX :watch: from NTP

UNIX time from NTP or short UtfN is a simple CLI tool to set the time from an NTP-Server.

  • Sets time and date using the date command present in all UNIX based systems like Ubuntu Linux, Manjaro or FreeBSD
  • NTP-Server can be specified using a CLI-argument
  • Timezone can be specified using a CLI-argument

Links

How it works

  1. UtfN requests the UTC time and date from the default or specified NTP-Server.
  2. UtfN calculates local time and date
  3. UtfN uses the date command to set the time and date

Usage

Execute the utfn from command line and add needed arguments.

Installation

UtfN can be installt from pip (recommandet):

python3 -m pip install -U utfn

If you want to run the latest version of the code, you can install from git:

python3 -m pip install -U git+git://github.com/datalexum/UNIX-time-from-NTP.git

Arguments

Longform Shortform Description Optional Default
help h Display help for the arguments :heavy_check_mark: False
server s Provide a specific NTP-Server :heavy_check_mark: pool.ntp.org
timezone z Timezone as a offset from UTC :heavy_check_mark: 0

Errors

There can be two different types of errors.

  1. Connection Error: It is not possible to connect to the NTP-Server. This can happen if there is no internet connection or the NTP-Server is not available.
  2. Permission Error: It is not possible to set the date on this system. It is likely that the user has no permission to set the date. Try using a user with higher permissions or add sudo before the command.

Examples

In the below example utfn is executed with the default NTP-Server and an UTC-offset of 1 to match CET (UTC+1) for the local time in my country.

utfn -z 1

If everything works as expected the set time is outputed:

Time set to 2 JAN 2022 14:32:17

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

UtfN-1.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

UtfN-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file UtfN-1.0.1.tar.gz.

File metadata

  • Download URL: UtfN-1.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for UtfN-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b5f4879a3609738df848b62707bc39203a3af0eab9e2d42544a46ba0886d16b5
MD5 51e299c270d8d85ee9c1534cb5f4238e
BLAKE2b-256 c0ab67d8f97e9b05e169f517ccec87e7d40591d8281b6ac7c929205698a6afa1

See more details on using hashes here.

File details

Details for the file UtfN-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: UtfN-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for UtfN-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19cad062b224062237a8ccd3a412fc84173b0a7820a25fe864969341fe04f4a0
MD5 f70510e36b38ef68b81bd115407c76a8
BLAKE2b-256 0a4963ead46d9527fdb6301f45c425b56aaee0f62d773fcfe4fd249e703dcf6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page