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

23 lines
385 B

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
}