Yaman Yaman - 6 days ago 6
C# Question

DateTime.Now retrieval speed

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 ?

Answer

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