Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conditional eeprom support #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Timezone.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
* San Francisco, California, 94105, USA. *
*----------------------------------------------------------------------*/

#include <avr/eeprom.h>
#include "Timezone.h"

#ifdef __AVR__
#include <avr/eeprom.h>
#endif

/*----------------------------------------------------------------------*
* Create a Timezone object from the given time change rules. *
*----------------------------------------------------------------------*/
Expand All @@ -21,6 +24,7 @@ Timezone::Timezone(TimeChangeRule dstStart, TimeChangeRule stdStart)
_std = stdStart;
}

#ifdef __AVR__
/*----------------------------------------------------------------------*
* Create a Timezone object from time change rules stored in EEPROM *
* at the given address. *
Expand All @@ -29,6 +33,7 @@ Timezone::Timezone(int address)
{
readRules(address);
}
#endif

/*----------------------------------------------------------------------*
* Convert the given UTC time to local time, standard or *
Expand Down Expand Up @@ -176,6 +181,7 @@ time_t Timezone::toTime_t(TimeChangeRule r, int yr)
return t;
}

#ifdef __AVR__
/*----------------------------------------------------------------------*
* Read the daylight and standard time rules from EEPROM at *
* the given address. *
Expand All @@ -197,3 +203,5 @@ void Timezone::writeRules(int address)
address += sizeof(_dst);
eeprom_write_block((void *) &_std, (void *) address, sizeof(_std));
}

#endif