DateTime.Now
calls internally :
public static DateTime Now
{
get
{
return DateTime.UtcNow.ToLocalTime();
}
}
which calls internally:
public static DateTime UtcNow
{
get
{
long systemTimeAsFileTime = DateTime.GetSystemTimeAsFileTime();
return new DateTime((ulong)(systemTimeAsFileTime + 504911232000000000L | 4611686018427387904L));
}
}
where GetSystemTimeAsFile is WindowsAPI function that return system clock information. The accurasy depends on system, so.
If you have a delay, for some reason between different gets (DateTime.Now
) it may produce different enough result that equality comparer fails. But I, personally, never met this kind of condition in my experience.