The kernel differentiates between setting time to now vs setting it to some timestamp (that may be very very recent past). For example, FUSE sets a separate flag that signals this:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=17637cbaba592076c221dc045ca78422b4af6290
This is normally achieved by passing NULL as times to utimes(2) and friends.
The Go syscall wrappers all explicitly prevent this:
func Utimes(path string, tv []Timeval) (err error) {
if len(tv) != 2 {
return EINVAL
}
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
}
My use case: I wanted to write a FUSE unit test that behaves like touch, and actually causes that flag to be set. Measuring current time and passing it as argument is not good enough.