cal.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void update_daylight (uint16_t time)

Function Documentation

void update_daylight ( uint16_t  time  ) 

Update DST: 02:00->03:00 on the last sunday of March 03:00->02:00 on the last sunday of October

And try to do this only once..

00014                                     {
00015     if (time == 0x0000) daylight_adjusted = 0;
00016     
00017     if (daylight_adjusted) return;
00018     
00019     if (time == 0x0200 || time == 0x0300) {
00020         if (rtc_xdow(-1) == 0) {
00021             switch (rtc_xmonth(-1)) {
00022                 case 3:
00023                     if (rtc_xday(-1) > 0x24) {
00024                         // last sunday of march
00025                         if (time == 0x0200) {
00026                             rtc_xhour(3);
00027                             daylight_adjusted = 1;
00028                         }
00029                     } else {
00030                         daylight_adjusted = 1;
00031                     }
00032                     break;
00033                 case 0x10:
00034                     if (rtc_xday(-1) > 0x24) {
00035                         // last sunday of october
00036                         if (time == 0x0300) {
00037                             rtc_xhour(2);
00038                             daylight_adjusted = 1;
00039                         }
00040                     } else {
00041                         daylight_adjusted = 1;
00042                     }  
00043                     break;
00044                 default:
00045                     daylight_adjusted = 1; 
00046                     break;
00047             }
00048         }
00049     }
00050 }


Generated on Wed Jan 27 00:29:56 2010 for Patashnik by  doxygen 1.6.1