You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
385 B
23 lines
385 B
4 years ago
|
package ntp
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestIsLocalTimeAccurate(t *testing.T) {
|
||
|
if !IsLocalTimeAccurate("0.pool.ntp.org") {
|
||
|
t.Fatal("local time is not accurate")
|
||
|
}
|
||
|
|
||
|
if IsLocalTimeAccurate("wrong.ip") {
|
||
|
t.Fatal("query ntp pool should failed")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestCurrentTime(t *testing.T) {
|
||
|
tt := CurrentTime("1.pool.ntp.org")
|
||
|
fmt.Printf("Current Time: %v\n", tt)
|
||
|
return
|
||
|
}
|