github.com/ccccaoqing/test@v0.0.0-20220510085219-3985d23445c0/src/syscall/syscall_darwin_test.go (about)

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build darwin
     6  // +build amd64 386
     7  
     8  package syscall_test
     9  
    10  import (
    11  	"syscall"
    12  	"testing"
    13  )
    14  
    15  func TestDarwinGettimeofday(t *testing.T) {
    16  	tv := &syscall.Timeval{}
    17  	if err := syscall.Gettimeofday(tv); err != nil {
    18  		t.Fatal(err)
    19  	}
    20  	if tv.Sec == 0 && tv.Usec == 0 {
    21  		t.Fatal("Sec and Usec both zero")
    22  	}
    23  }