Skip to content

Commit ad2604d

Browse files
committed
Release v1.0.0
This package has been stable for several years with no bug reports in that time. It is also pretty much feature complete. I am therefore updating the version to 1.0.0. Because this is a major release, the previously deprecated TimeV functions has been removed.
1 parent af4a82b commit ad2604d

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

RELEASE_NOTES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
Release v1.0.0
2+
==============
3+
4+
This package has been stable for several years with no bug reports in that
5+
time. It is also pretty much feature complete. I am therefore updating the
6+
version to 1.0.0.
7+
8+
Because this is a major release, all previously deprecated code has been
9+
removed from the package.
10+
11+
**Breaking changes**
12+
13+
* Removed the `TimeV` function. Use `Time` or `QueryWithOptions` instead.
14+
115
Release v0.3.2
216
==============
317

ntp.go

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@ func (m *msg) setLeap(li LeapIndicator) {
149149
m.LiVnMode = (m.LiVnMode & 0x3f) | uint8(li)<<6
150150
}
151151

152-
// getVersion returns the version value in the message.
153-
func (m *msg) getVersion() int {
154-
return int((m.LiVnMode >> 3) & 0x07)
155-
}
156-
157152
// getMode returns the mode value in the message.
158153
func (m *msg) getMode() mode {
159154
return mode(m.LiVnMode & 0x07)
@@ -302,17 +297,15 @@ func QueryWithOptions(host string, opt QueryOptions) (*Response, error) {
302297
return parseTime(m, now), nil
303298
}
304299

305-
// TimeV returns the current time using information from a remote NTP server.
306-
// On error, it returns the local system time. The version may be 2, 3, or 4.
307-
//
308-
// Deprecated: TimeV is deprecated. Use QueryWithOptions instead.
309-
func TimeV(host string, version int) (time.Time, error) {
310-
m, recvTime, err := getTime(host, QueryOptions{Version: version})
300+
// Time returns the current time using information from a remote NTP server.
301+
// It uses version 4 of the NTP protocol. On error, it returns the local
302+
// system time.
303+
func Time(host string) (time.Time, error) {
304+
r, err := Query(host)
311305
if err != nil {
312306
return time.Now(), err
313307
}
314308

315-
r := parseTime(m, recvTime)
316309
err = r.Validate()
317310
if err != nil {
318311
return time.Now(), err
@@ -322,13 +315,6 @@ func TimeV(host string, version int) (time.Time, error) {
322315
return time.Now().Add(r.ClockOffset), nil
323316
}
324317

325-
// Time returns the current time using information from a remote NTP server.
326-
// It uses version 4 of the NTP protocol. On error, it returns the local
327-
// system time.
328-
func Time(host string) (time.Time, error) {
329-
return TimeV(host, defaultNtpVersion)
330-
}
331-
332318
// getTime performs the NTP server query and returns the response message
333319
// along with the local system time it was received.
334320
func getTime(host string, opt QueryOptions) (*msg, ntpTime, error) {

0 commit comments

Comments
 (0)