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

28 lines
484 B

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