github.com/go-eden/common@v0.1.15-0.20210617133546-059099253264/etime/cgo/now.go (about) 1 package cgo 2 3 /* 4 #include <time.h> 5 #include <sys/time.h> 6 #include <stdlib.h> 7 8 long now() { 9 struct timeval time; 10 gettimeofday(&time, NULL); 11 return time.tv_sec * 1000000 + time.tv_usec; 12 } 13 */ 14 import "C" 15 16 func Now() int64 { 17 n := C.now() 18 return int64(n) 19 }