2016-06-01 07:56:20 +00:00
|
|
|
[](https://travis-ci.org/beevik/ntp)
|
|
|
|
[](https://godoc.org/github.com/beevik/ntp)
|
|
|
|
|
2016-01-21 03:19:15 +00:00
|
|
|
ntp
|
|
|
|
===
|
|
|
|
|
2017-02-28 21:59:37 +00:00
|
|
|
The ntp package is an implementation of a simple NTP client. It allows you
|
|
|
|
to connect to a remote NTP server and request the current time.
|
2016-01-21 03:19:15 +00:00
|
|
|
|
2017-02-28 21:59:37 +00:00
|
|
|
To request the current time using version 4 of the NTP protocol, simply do the
|
|
|
|
following:
|
|
|
|
```go
|
|
|
|
time, err := ntp.Time("0.pool.ntp.org")
|
|
|
|
```
|
2016-01-21 03:19:15 +00:00
|
|
|
|
2017-02-28 21:59:37 +00:00
|
|
|
To request the current time along with additional metadata, use the Query
|
|
|
|
function:
|
|
|
|
```go
|
|
|
|
response, err := ntp.Query("0.pool.ntp.org", 4)
|
|
|
|
```
|