Assuming the Timeval is like the C systemcall struct, it takes seconds since 1970 and microseconds. On the Go time.Time struct you have Unix() which gives you the seconds and UnixNano() which gives you nanoseconds. The latter you will need to divide and mod to only get the subsecond part. Then you fill in the corresponding values in the timeval.
Edit: Oh, I see the struct. So, something line this, possibly (untested):
t := ... // a time.Time
tv := syscall.Timeval {
Sec: t.Unix(), // might be int32 on 32 bit architectures
Usec: int32(t.UnixNano() / 1000 % 1000),
}
I get that. Sorry i didn’t make myself clear. I was hoping something similar to say ‘time.Time.String()’ which displays in date/time format that is easily readable. Anyway I was missing on the below part.