// Gettimeofday implements linux syscall gettimeofday(2).
Gettimeofday implements linux syscall gettimeofday(2).
// Gettimeofday implements linux syscall gettimeofday ( 2 ) .
func Gettimeofday(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {
	tv := args[0].Pointer()
	tz := args[1].Pointer()
	if tv != hostarch.Addr(0) {
		nowTv := t.Kernel().RealtimeClock().Now().Timeval()
		if err := copyTimevalOut(t, tv, &nowTv); err != nil {
			return 0, nil, err
		}
	}
	if tz != hostarch.Addr(0) {
		_, offset := time.Now().Zone()
		timezone := []int32{-int32(offset) / 60, 0}
		_, err := primitive.CopyInt32SliceOut(t, tz, timezone)
		return 0, nil, err
	}
	return 0, nil, nil
}
func Gettimeofday ( t * kernel . Task , args arch . SyscallArguments ) ( uintptr , * kernel . SyscallControl , error ) { tv := args [ 0 ] . Pointer ( ) tz := args [ 1 ] . Pointer ( ) if tv != hostarch . Addr ( 0 ) { nowTv := t . Kernel ( ) . RealtimeClock ( ) . Now ( ) . Timeval ( ) if err := copyTimevalOut ( t , tv , & nowTv ) ; err != nil { return 0 , nil , err } } if tz != hostarch . Addr ( 0 ) { _ , offset := time . Now ( ) . Zone ( ) timezone := [ ] int32 { - int32 ( offset ) / 60 , 0 } _ , err := primitive . CopyInt32SliceOut ( t , tz , timezone ) return 0 , nil , err } return 0 , nil , nil }
Gettimeofday implements linux syscall gettimeofday(2).
Gettimeofday implements linux syscall gettimeofday ( 2 ) .
// Ask the time package for the timezone. // This int32 array mimics linux's struct timezone.