rsdate connects to an ntp server, printing the returned time and/or sets the system clock.

Overview

πŸ¦€ πŸ“…
rsdate

rsdate connects to an ntp server, printing the returned time and/or sets the system clock.


Example:

$ rsdate pool.ntp.org
[2021-10-11T05:02:32Z INFO  rsdate] [pool.ntp.org]	Mon, 11 Oct 2021 15:02:32 +1000

Download

Pre-compiled binaries are available for a number of platforms.

Example to download and extract a binary:

curl https://releases.wezm.net/rsdate/0.2.0/rsdate-0.2.0-x86_64-unknown-linux-musl.tar.gz | tar zxf -

Usage

USAGE:
    rsdate [OPTIONS] 
   
    

ARGS:
    
    
     
        The ntp server to contact.

OPTIONS:
    -h, --help
            Prints help information

    -p, --print
            Print the time returned by the server.

    -r, --retry NUMBER
            If retrieving the time fails retry NUMBER times. Retries are made
            at 1, 2, 4, 8, 16, etc. seconds.  A value of 0 disables retry
            (default). A negative value retries forever.

    -s, --set
            Set the system time to the returned time.

    -t, --timeout TIMEOUT
            Sets response timeout in seconds. [default: 10]

    -l, --syslog
            Print messages to syslog.

    -V, --version
            Prints version information

    
   

Build from Source

Minimum Supported Rust Version: 1.53.0

rsdate is implemented in Rust. See the Rust website for instructions on installing the toolchain.

From Git Checkout or Release Tarball

Build the binary with cargo build --release --locked. The binary will be in target/release/rsdate.

From crates.io

cargo install rsdate

Credits

This tool is inspired by rdate.

Licence

This project is dual licenced under either of:

at your option.

You might also like...
A pure Rust reimplementation of libc functions localtime, gmtime and mktime.

tz-rs A pure Rust reimplementation of libc functions localtime, gmtime and mktime. This crate allows to convert between a Unix timestamp and a calenda

A clock app in terminal written in Rust, supports local clock, timer and stopwatch.
A clock app in terminal written in Rust, supports local clock, timer and stopwatch.

clock-tui (tclock) A clock app in terminal. It support the following modes: Clock Timer Stopwatch Countdown Usage Install Install excutable by cargo:

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

πŸ¦€ Rust library for printing human readable, relative time differences

πŸ¦€ Rust library for printing human readable, relative time differences

A command-line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the returned URL.
A command-line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the returned URL.

Pup A command line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the return

Cocom - NTP client written in Rust

Cocom is an implementation of the NTP-protocol, to receive the time from NTP-server. The client does not necessarily need arguments.

An NTP implementation in Rust, supported by Internet Security Research Group's Prossimo project.

NTPD-rs NTPD-rs is an implementation of NTP completely written in Rust, with a focus on exposing a minimal attack surface. The project is currently in

A proc macro for creating compile-time checked CSS class sets, in the style of classNames

semester Semester is a declarative CSS conditional class name joiner, in the style of React's classnames. It's intended for use in web frameworks (lik

Connects to Woodpecker CI and dynamically creates an agent in the cloud.

Picus Picus connects to a Woodpecker CI server and creates an agent in the cloud when there are pending jobs. The agent will be shutdown when there ar

Narrowlink securely connects devices and services together, even when both nodes are behind separate NAT

Narrowlink Narrowlink is a self-hosted platform that allows you to establish secure remote connections between devices within a network that may be hi

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust. These libraries will help keeping your types and data structures synchronized, and enable seamless exchange between OCaml and Rust

Simple, automatic, and customizable tree pretty-printing in Rust.
Simple, automatic, and customizable tree pretty-printing in Rust.

display_tree Simple, automatic, and customizable tree pretty-printing in Rust. This crate provides tools to easily pretty-print data as a tree, includ

πŸšƒ lib for CLI utilities, printing, and error handling

axocli Common code for setting up a CLI App and handling errors/printing. Example See examples/axoapp.rs for a walkthrough/example. Some various inter

SP3 Precise GNSS Orbit and Clock parser :artificial_satellite:

SP3 SP3 Precise GNSS Orbit files parser. SP3 is specifid by IGS. The parser only supports Revisions C & D at the moment and rejects revisions A & B. G

in progress pretty printing calculator language
in progress pretty printing calculator language

in progress pretty printing calculator language

Debug2 is a pretty printing crate based on std::fmt

debug2 is a pretty printing crate based on std::fmt Why not just use Debug The Debug trait is good, but the problem is it is not very good at n

Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.

2D graphics in any programming language with just print statements!

This is a Pomodoro Clock implemented as a Zellij plugin.

Pomodoro Clock This is a Pomodoro Clock implemented as a Zellij plugin. It shows a Pomodoro time as well as current date time. Prerequisite You must i

Arduino Nano frequency counter with atomic clock accuracy
Arduino Nano frequency counter with atomic clock accuracy

Arduino Nano frequency counter with atomic clock accuracy Project description and test setup With this project you can measure a frequency from less t

Comments
  • Revert

    Revert "Bind to '[::]' for IPv6 support"

    This reverts commit 4b38bee4b358f6fa370512f411ea8e88b15133fd.

    The original change didn't work on macOS and FreeBSD, nor the custom Linux image I'm building for a Raspberry Pi without IPv6 support.

    opened by wezm 0
  • Fails when -l argument is supplied

    Fails when -l argument is supplied

    https://github.com/wezm/rsdate/commit/ab867f2aee36075acc875a9b0039f9580c41063a changed the handling of the -l argument so that the logger could be installed earlier. The problem was that now -l was no handled in the main argument parsing function which cased it to be the first free argument. I.e. the ntp server. This would then fail and return an error. Extract from strace:

    sendto(5, "{\"method\":\"io.systemd.Resolve.ResolveHostname\",\"parameters\":{\"name\":\"-l\",\"flags\":0}}\0", 85, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 85
    mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fee476e7000
    recvfrom(5, 0x7fee476e7010, 135152, MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
    
    opened by wezm 0
  • Deal with time_t deprecation warning from libc crate

    Deal with time_t deprecation warning from libc crate

    warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
     --> src/time.rs:4:32
      |
    4 | use libc::{c_int, suseconds_t, time_t, timeval, timezone};
      |                                ^^^^^^
      |
      = note: `#[warn(deprecated)]` on by default
    
    opened by wezm 0
  • Bump regex from 1.5.4 to 1.5.6

    Bump regex from 1.5.4 to 1.5.6

    Bumps regex from 1.5.4 to 1.5.6.

    Changelog

    Sourced from regex's changelog.

    1.5.6 (2022-05-20)

    This release includes a few bug fixes, including a bug that produced incorrect matches when a non-greedy ? operator was used.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
Owner
Wesley Moore
Developer with an interest in systems ranging from microcontrollers to web applications. Fan of Rust, Linux, and FreeBSD.
Wesley Moore
Date and time library for Rust. Feature rich, lightweight and easy-to-use.

Astrolabe Date and time library for Rust. Feature rich, lightweight and easy-to-use. Documentation | Github | Crate Example Status Astrolabe is curren

Jasmin 2 Sep 2, 2022
Date and time library for Rust

Chrono: Date and Time for Rust It aims to be a feature-complete superset of the time library. In particular, Chrono strictly adheres to ISO 8601. Chro

Chronotope 2.5k Jan 8, 2023
A simple and fun way to view the time!

Concentric Time A simple and fun way to view the time! Screenshots Dark mode Light mode Dev This project uses Dioxus (a Rust-Wasm framework) and does

Parker McMullin 9 Oct 23, 2022
A set of tools for generating signed exchanges at serve time.

sxg-rs sxg-rs is a set of tools for generating signed exchanges at serve time: cloudflare_worker runs on Cloudflare Workers. fastly_compute runs on Fa

Google 64 Dec 26, 2022
Time series anomaly detection for Rust

AnomalyDetection.rs Time series AnomalyDetection for Rust Learn how it works Installation Add this line to your application’s Cargo.toml under [depend

Andrew Kane 6 Nov 21, 2022
datez: convert a time into several timezones

datez: convert a time into several timezones In July, when it is 16:00 in Canberra, what time is it in Caracas, and where I am in Cambridge? $ datez 2

Tony Finch 7 Nov 17, 2021
Get unix time (nanoseconds) in blazing low latency with high precision

RTSC Get unix time (nanoseconds) in blazing low latency with high precision. About 5xx faster than SystemTime::now(). Performance OS CPU benchmark rts

β…’x 8 Jul 14, 2022
Generate perfect code headers every time.

Generate perfect code headers every time.

t11s 111 Dec 28, 2022
This crate provides high-performance formatting and parsing routines for ISO8061 timestamps

ISO8061 Timestamp This crate provides high-performance formatting and parsing routines for ISO8061 timestamps, primarily focused on UTC values but wit

Lantern 4 Sep 21, 2022
eos is a datetime library for Rust, aimed at being robust, simple, and easy to use

eos eos is a datetime library for Rust, aimed at being robust, simple, and easy to use. eos is made with the assumption of operating under a proleptic

Danny 51 Dec 19, 2022