Please look at the code, this is a prime number code, use timestamp UnixNano () and the time needed for this code runs, found a problem: if the value is 501 v the following number, operation result is 0, if the value is 501 v, the running result is 1000000, is a nanosecond timestamps of the minimum value is 1000000, bosses give advice or comments, thank you ~
CodePudding user response:
Not the
Try using the following code
s:=time Now () UnixNano () Time. Sleep time. The Nanosecond * 1)//stop 1 Nanosecond E:=time. Now (). UnixNano () FMT. Printf (" % d, % d, % d \ n ", s, e, e - s) CodePudding user response:
reference 1st floor qybao response: not the Try using the following code s:=time Now () UnixNano () Time. Sleep time. The Nanosecond * 1)//stop 1 Nanosecond E:=time. Now (). UnixNano () FMT. Printf (" % d, % d, % d \ n ", s, e, e - s) Bosses, according to the code you tried running results: 1578287106372698900 1578287106371698900 1000000 Dormancy 1 nanosecond or 100 w nanoseconds, or a few microseconds, a few milliseconds, as long as it is within 100 w nanosecond time number, run results nanosecond is 1000000, isn't me is a problem with the program CodePudding user response:
You are a Windows system? Windows system seems to be calculated on a 100 nanoseconds https://stackoom.com/question/2pryv/why time on Windows - Duration of nanosecond value will fall to the nearest - multiples CodePudding user response:
The reference 3 floor qybao response: are you Windows? Windows system seems to be calculated on a 100 nanoseconds https://stackoom.com/question/2pryv/why time on Windows - Duration of nanosecond value will be down to the nearest - multiple Right, is a Windows system, it could be the system problem, 100 w nanosecond is equivalent to 1 nanoseconds, also not too long, the impact is not big, involves a question of time later I would note that there is such a thing to go, thank you very much CodePudding user response:
reference 4 floor m0_38130725 response: Quote: reference qybao reply: 3/f are you Windows? Windows system seems to be calculated on a 100 nanoseconds https://stackoom.com/question/2pryv/why time on Windows - Duration of nanosecond value will be down to the nearest - multiple Right, is a Windows system, it could be the system problem, 100 w nanosecond is equivalent to 1 nanoseconds, also not too long, the impact is not big, later involves a question of time again, I'll pay attention to there is such a thing to go, thank you very much Should be 100 w nanosecond is equivalent to 1 millisecond, got the wrong number??