Hi Guys,
I am trying to get the graphical demo running on my cobra, and am getting an exception here:
if (RealTimeClock.IsTimeValid)
Utility.SetLocalTime(RealTimeClock.GetTime());
It is going on the SetLocalTime:
The thread ‘’ (0x2) has exited with code 0 (0x0).
#### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (1) ####
#### Message:
#### System.DateTime::.ctor [IP: 0000] ####
#### GHIElectronics.NETMF.Hardware.RealTimeClock::GetTime [IP: 001e] ####
#### GHIGraphicalDemo.Presentation.Taskbar::.ctor [IP: 0099] ####
#### GHIGraphicalDemo.Presentation.Desktop::.ctor [IP: 011b] ####
#### GHIGraphicalDemo.Program::Main [IP: 0043] ####
A first chance exception of type ‘System.ArgumentOutOfRangeException’ occurred in mscorlib.dll
An unhandled exception of type ‘System.ArgumentOutOfRangeException’ occurred in mscorlib.dll
As A test I did this:
if (RealTimeClock.IsTimeValid)
{
DateTime dtNow = RealTimeClock.GetTime();
}
This also caused the exception.
So I did this:
if (RealTimeClock.IsTimeValid)
{
RealTimeClock.SetTime(DateTime.Today);
DateTime dtNow = RealTimeClock.GetTime();
Utility.SetLocalTime(RealTimeClock.GetTime());
}
Now everything worked.
So it looks like IsTimeValid can return true even when the DateTime is not valid!
Maybe a bug?
Cheers
Andy