Low Power documentation needs a correction

Hi,

I was using the Low Power documentation (https://www.ghielectronics.com/docs/141/low-power) to test that feature on a FezCerb 40 II.
Struggled sometime with it because I was not seeing the alarm to wake up the board.
The cause for that is that DateTime.Now gives a different time of GHI.Processor.RealTimeClock.GetDateTime() unless they are previously synced.

One has to either set the RTC alarm using the RTC object itself:
RealTimeClock.SetAlarm(GHI.Processor.RealTimeClock.GetDateTime().AddSeconds(30));

instead of:
RealTimeClock.SetAlarm(DateTime.Now.AddSeconds(30));

or alternatively sync both clocks beforehand using
DateTime myTime = …
RealTimeClock.SetDateTime(myTime);
Utility.SetLocalTime(RealTimeClock.GetDateTime());

and then the original code that is using DateTime.Now will work.

I hope I was able to explain myself… :slight_smile:

Cheers,

The internal NETMF time keeping is different than the hardware real time clock (RTC). The internal time keeping can be updated from the RTC or from the network, or any other source of correct time. I think this is explained in the timer tutorial.

We will see what we can do to update.

Hi Gus,

Yes that is very well explained in the and RTC timer tutorials. (that’s what help me debug the issue).

My suggestion is that you change the example code to use the RealTimeClock.GetDateTime() instead of DateTime.Now and/or add a note stressing that the RTC time keeping is different than the NETMF time therefore people need to be careful when setting the RTC alarm, otherwise it may not trigger.

I agree