https://github.com/nigelhorne/ntpdate
Simple NTP client
https://github.com/nigelhorne/ntpdate
ntp-client ntpdate perl perl5
Last synced: about 1 month ago
JSON representation
Simple NTP client
- Host: GitHub
- URL: https://github.com/nigelhorne/ntpdate
- Owner: nigelhorne
- License: gpl-2.0
- Created: 2017-06-13T12:00:00.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-04T12:53:19.000Z (over 1 year ago)
- Last Synced: 2025-03-04T13:42:30.838Z (over 1 year ago)
- Topics: ntp-client, ntpdate, perl, perl5
- Language: Perl
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ntpdate
=======
# NTP Time Sync Script


This Perl script synchronizes the system time with an NTP server and updates the system clock.
Please report any bugs or feature requests to the author.
This module is provided as-is without any warranty.
## Features
- Retrieves network time using an NTP server.
- Implements retry logic (up to 3 attempts) if time retrieval fails
- Converts and formats the time using `DateTime`.
- Supports configurable timezones via `config.cfg`.
- Logs events using `syslog`.
- Updates the system clock (requires sudo privileges).
## Requirements
- Perl
- Required Perl Modules:
- `Net::NTPTime`
- `DateTime`
- `Sys::Syslog`
- `Config::Abstraction`
- Linux-based system, or similar (for `date` command execution)
## Installation
### Clone the Repository
```sh
git clone https://github.com/nigelhorne/ntpdate.git
cd ntpdate
```
### Install Dependencies
```sh
cpanm Net::NTPTime DateTime Sys::Syslog Config::Abstraction
```
## Usage
Run the script with an NTP server:
```sh
perl ./ntpdate pool.ntp.org
```
## Configuration
To change the default timezone, create a `~/conf/ntpdate` file:
```ini
timezone=America/New_York
```
## GitHub Actions
This project includes a GitHub Actions workflow to:
- Install dependencies
- Run the script with a test NTP server
- Lint the Perl script
## Logging and Error Handling
- If the script fails to retrieve the time, it will retry up to **3 times** before exiting with an error.
- Logs are recorded via C for debugging and monitoring.
## **Licence Agreement**
### **Personal Use:**
This program is **free to use** for a **single individual** on **one computer** for **personal, non-commercial purposes only**.
### **Restricted Use:**
Any other use—including but not limited to **commercial, charitable, educational, or government organizations**—**requires a written license agreement**.
### **License Application:**
Organizations or individuals falling outside the personal-use terms **must request written permission** and obtain a license before using this program.
For licensing enquiries, please contact: **< njh @ nigelhorne.com >**.
This module is provided as-is without any warranty.