https://github.com/leomariga/sync_windows_time
A lightweight python code to synchronize windows time to NTP servers.
https://github.com/leomariga/sync_windows_time
clock-synchronization ntp python system-clock time-synchronization windows windows-automation windows-time
Last synced: 3 months ago
JSON representation
A lightweight python code to synchronize windows time to NTP servers.
- Host: GitHub
- URL: https://github.com/leomariga/sync_windows_time
- Owner: leomariga
- License: mit
- Created: 2025-03-29T17:41:00.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-29T18:08:34.000Z (3 months ago)
- Last Synced: 2025-03-29T18:33:40.428Z (3 months ago)
- Topics: clock-synchronization, ntp, python, system-clock, time-synchronization, windows, windows-automation, windows-time
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Windows Time Sync Tool ⏰
Update Windows clock by syncing with NTP servers - the built-in sync simply doesn't work on my computer.
## Why
Built after frustration with Windows' sync repeatedly failing. This tool actually works.
## Features
- Uses multiple NTP servers (Google, Windows, NIST)
- Shows time difference
- Auto-updates system time
- Admin privileges handled via batch file## Requirements
- Windows OS
- Python 3.x
- Administrator privileges (for setting the system time)
## Usage### One-time Sync
1. Right-click on `run_sync_admin.bat` and select "Run as administrator"
2. The script will automatically:
- Connect to available NTP servers
- Display the time difference
- Update your system timeThat's it! Your system clock is now accurate.
### Auto-run at Windows Startup
To automatically sync your clock every time Windows starts:
1. Press `Win + R` to open the Run dialog
2. Type `shell:startup` and press Enter
3. Create a shortcut to `run_sync_admin.bat` in this folder
- Right-click in the Startup folder → New → Shortcut
- Browse to the location of `run_sync_admin.bat` and select it
- Click Next and FinishAlternatively, you can set up a scheduled task:
1. Open Task Scheduler (search for it in the Start menu)
2. Create a Basic Task
- Set trigger to "When I log on"
- Action: Start a program
- Program/script: Select the full path to `run_sync_admin.bat`
- Select "Run with highest privileges"## How It Works
The script connects to NTP servers using the UDP protocol, retrieves the current accurate time, and uses Windows commands to update your system clock. All operations require administrator privileges since changing system time is a protected operation.
## License
Feel free to use, modify, and distribute this code however you like!
## Contributions
Found a bug or want to improve something? Pull requests are welcome!