DateTime.Now within a statement
Posted
by jarrett
on Stack Overflow
See other posts from Stack Overflow
or by jarrett
Published on 2010-04-06T21:39:20Z
Indexed on
2010/04/06
21:43 UTC
Read the original article
Hit count: 142
In the below thisIsAlwaysTrue should always be true.
DateTime d = DateTime.Now;
bool thisIsAlwaysTrue = d == d;
But does DateTime.Now work in such a way that isThisAlwaysTrue is guaranteed to be true? Or can the clock change between references to the Now property?
bool isThisAlwaysTrue = DateTime.Now == DateTime.Now;
© Stack Overflow or respective owner