Arpssss
Arpssss

Reputation: 3858

Go - System Time in pico-second

Is it possible in go to get system time in less than nano second means in pico-second or like that? Actually, I want to measure two consecutive events time gap which I can't catch in nano-second in our fast system.

Upvotes: 1

Views: 622

Answers (2)

peterSO
peterSO

Reputation: 166825

The time resolution is hardware and operating system dependent. The Go time.Nanoseconds function provides up to nanosecond time resolution. On a PC, it's usually 1000 nanoseconds (1 microsecond) or 100 nanoseconds at best.

Upvotes: 3

Lyth
Lyth

Reputation: 2211

The cost of calling profiling functions/instructions on modern hardware is larger (and mor espread and prone to deviance) than the interval you're going to measure. So even if you try, you'll get erroneous results.

Consider tracking time lapse for 100 events, if that's at all possible.

Upvotes: 4

Related Questions