Exemplo n.º 1
0
// TODO(sgotti) for the moment just use a syscall so it'll work on all linux
// architectures. It's slower than using a vdso but we don't have such performance
// needs. Let's wait for a stdlib native monotonic clock.
func Now() int64 {
	var ts syscall.Timespec
	syscall.Syscall(syscall.SYS_CLOCK_GETTIME, CLOCK_MONOTONIC, uintptr(unsafe.Pointer(&ts)), 0)
	nsec := ts.Nano()
	return nsec
}