Created
September 13, 2017 19:09
-
-
Save lisa/7620c8cd47a428b911aa8f2ad9b1a512 to your computer and use it in GitHub Desktop.
settimeofday.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"syscall" | |
"time" | |
) | |
func main() { | |
t := time.Now() | |
fmt.Println("Current time: ", t) | |
sec := t.Unix() | |
usec := t.UnixNano() | |
fmt.Println(sec, usec) | |
tv := syscall.Timeval{sec, usec} | |
} | |
// Line 15 fails with: | |
// # command-line-arguments | |
// set_time.go:15: cannot use usec (type int64) as type int32 in field value | |
// set_time.go:15: too few values in struct initializer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment