Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/unityfetchoffsetntp.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **Unity Fetch Offset NTP** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/unityfetchoffsetntp.git
```

[![pkglnk](https://www.pkglnk.dev/badge/unityfetchoffsetntp.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/unityfetchoffsetntp)

Used By (2)

README

2024_07_07_UnityFetchOffsetNTP

Just a tool to fetch the offset from a NTP server in Unity3D

image

If you need to check with Python:


import ntplib
from time import ctime, time, sleep

def check_ntp_server(server):
    client = ntplib.NTPClient()
    try:
        response = client.request(server, version=3)
        ntp_time = response.tx_time
        local_time = time()
        time_difference = (local_time - ntp_time) * 1000  # Convert to milliseconds
        print(f"Server {server} is reachable.")
        print(f"NTP Time: {ctime(ntp_time)}")
        print(f"Local Time: {ctime(local_time)}")
        print(f"Time Difference: {time_difference:.2f} ms")
    except Exception as e:
        print(f"Failed to reach NTP server {server}. Error: {e}")

if __name__ == "__main__":
    ntp_server = '192.168.1.118'
    ntp_server = '193.150.14.47'
    ntp_server = 'raspberrypi5'
    ntp_server = 'time.google.com'
    
    while True:
        check_ntp_server(ntp_server)
        sleep(1)

Comments

No comments yet. Be the first!