What you are setting is the system clock and not the hardware RTC. The hardware RTC is set through a class that is not in current firmware yet so you can’t use it.
We have added this, along with many other new things, to the new firmware which will be available this week.
When new SDK is out in couple days, take a look at documentation and look for RTC. If you still can’t find it then let me know and I will give you an example.
I never said it is not there! I am saying if it is not working then you are probably not using it correctly and should see the example in documentation.
Someone should change the e-book, because it’s quite misleading:
"All GHI NETMF devices have a built in RTC. The RTC keep track of time and date. Even if
the system is off, the RTC will be running off a backup battery.
Here is an example that prints the current time and date to the debug output window."
(example follows which fetches the local time only, and does not access the RTC)
I seem to behaving a similar problem to that described above. I mounted the 3 volt battery(+ to GND, - to VBAT), have checked all connections to make sure the voltage is getting thru correctly, but on each reboot (after removing power), the RTC is resetting to 01/01/1997. I have used the code in the example documentation exactly but it is still resetting.
Steps: Have this code in a button event:
RealTimeClock.SetTime(new DateTime(2010, 12, 27, 20, 55, 00, 00));
Utility.SetLocalTime(RealTimeClock.GetTime());
Next: Reboot (remove frm power and plug in again) and first lines in Main:
OK, neermind, looks like I solved my own problem…went back and resoldered everything, doesn’t “look” or read on a voltmeter any different…but…apparently it is. Did I mention I was new to all this stuff? lol Thanks Anyway
I was having some trouble with the RTC on my Cerbuinos today. I think it’s kinda lame that I had to add a crystal since my Pandas came with those, but whatever. My problem was that, even with the battery and the crystal I was still losing time. Turns out it’s because of this line at the top of my program…
GHI.OSHW.Hardware.RTC.Initialize();
You need to call this to initialize the RTC, but only once with the batt and crystal in place otherwise it overwrites the time. This was the first line of my program. WRONG! My date kept getting cleared out. So I replaced my one line with these four…
This way my code only initializes the RTC (and clears the time) when needed. I wanted to use “if (rtcDate == DateTime.MinValue)” but apparently RTC.Initialize() uses some other date. I’d also suggest changing that, but what do I know…