The core protocol of WoopChain
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.
woop/common/ntp/ntp_test.go

25 lines
471 B

package ntp
import (
"fmt"
"testing"
)
func TestCheckLocalTimeAccurate(t *testing.T) {
accurate, err := CheckLocalTimeAccurate("0.pool.ntp.org")
if !accurate {
t.Fatalf("local time is not accurate: %v\n", err)
}
accurate, err = CheckLocalTimeAccurate("wrong.ip")
if accurate {
t.Fatalf("query ntp pool should failed: %v\n", err)
}
}
func TestCurrentTime(t *testing.T) {
tt := CurrentTime("1.pool.ntp.org")
fmt.Printf("Current Time: %v\n", tt)
return
}