Beispiel #1
0
func getTimeval(t time.Time) *unix.Timeval {
	nsec := int64(t.Sub(time.Now()))
	timeval := unix.NsecToTimeval(nsec)
	return &timeval
}
Beispiel #2
0
func (pc *packetSock) SetReadTimeout(t time.Duration) error {

	tv := unix.NsecToTimeval(t.Nanoseconds())
	return unix.SetsockoptTimeval(pc.fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &tv)
}