Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTime.Now retrieval speed

Tags:

c#

.net

Is there any chance that this statement would return true

DateTime.Now == DateTime.Now

can a very fast machine return true for this statement, I tried on several machines and its always false ?

like image 909
Yaman Avatar asked Nov 30 '16 21:11

Yaman


1 Answers

Yes.

The resolution of this property depends on the system timer, which is approximately 15 milliseconds on Windows systems.As a result, repeated calls to the Now property in a short time interval, such as in a loop, may return the same value.

source: https://msdn.microsoft.com/en-us/library/system.datetime.now(v=vs.110).aspx

like image 63
Jan Paolo Go Avatar answered Oct 21 '22 08:10

Jan Paolo Go