A small tool that detects your public IP, resolves the correct IANA timezone for that IP, and optionally applies the timezone to your operating system.
The script runs in dry-run mode by default. Use --apply to make actual changes. On Linux you may need sudo. On Windows you must run in an elevated command prompt.
- Detect public IP
- Resolve IANA timezone from IP using external APIs
- Optional fallback using Selenium and proxy6.net
- Automatic caching to avoid API rate limits
- Safe dry-run mode
- Windows timezone application via
tzutil - Linux timezone application via
timedatectl
git clone cd set-time-by-ip python -m venv venv venv\Scripts\activate # Windows
or
source venv/bin/activate # Linux/macOS
pip install -r requirements.txt
Dry run:
python set_time_by_ip.py
Apply timezone:
python set_time_by_ip.py --apply
Apply without confirmation:
set_time_by_ip.py– main scriptsettings.py– configuration and mappingsselenium_fallback.py– alternative timezone detection via proxy6.netrequirements.txt– dependencies.gitignore– ignored filesLICENSE– MIT license
- On Windows, timezone application requires an administrator shell.
- On Linux, timezone application may require sudo.
- Actual system time is not modified by this script; only timezone.