Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master
Commits on Dec 7, 2014
  1. Merge pull request #12 from Yewess/days_between

    Leap Days between
  2. Merge pull request #11 from Yewess/utilities

    fix days-in-year calculation bug.
  3. @cevich

    Rtc_Pcf8563 specific version of leapYearsBetween

    cevich authored
    In order to calculate a duration which could span
    any number of leap and non-leap years, it's necessary
    to account for them.  This method returns the number
    of leap-days for years from start to end (exclusive).
    The century-bit handling behavior matches that of
    the chip and other calculation methods here.
    Signed-off-by: Chris Evich <>
Commits on Dec 3, 2014
  1. @cevich

    fix days-in-year calculation bug.

    cevich authored
    The algorithm idea was accurate but the lookup table was wrong.
    It's also a bit simpler to just include the 0th element since
    the conditionals to test for it likely occupy more than one
    byte anyway.  Tested this version with multiple months in and out
    of leap-years and it's producing correct results now.
    Signed-off-by: Chris Evich <>
  2. Merge pull request #10 from Yewess/utilities

    Add a handful of date-related utility methods
    Great job! Thank you.
Commits on Dec 2, 2014
  1. @cevich

    Add a handful of date-related utility methods

    cevich authored
    * isLeapYear()
    * daysInMonth()
    * daysInYear()
    * whatWeekday()
    I made them all pure so they can be used with stored values.  For
    example, calculating durations across month/year boundariess in
    arbitrary terms (i.e. days, minutes, seconds, etc).  This also
    helps provide enough information to fill out the standard time_t
    Signed-off-by: Chris Evich <>
  2. Merge pull request #4 from Yewess/clean_race_timer

    Fix race condition & code cleanup
Commits on Dec 1, 2014
  1. @cevich

    Add zeroClock() to zero out date/time

    cevich authored
    Initializing to anything else requires providing
    the initial values to callers for comparison / calculation.
    It also potentially complicates weekday/leap year
    calculation vs elapsed wall-clock.
    Adds a zeroClock() member function that
    resets everything to the lowest possible
    value/meaning (i.e. 0, 1, 1900). This gives a
    simpler point of reference for callers and will
    interface better with other widly available date/time
    library representations.
    The old initClock() is still present with previous values
    to maintain backward compatibility.
    Signed-off-by: Chris Evich <>
  2. @cevich

    Minor re-arranging + various fixes

    cevich authored
    * Re-arranged header slightly, added comments
    * Re-arranged implementation to match header, added comments
    * Fixed some alarm retrieval functions to use getDateTime()
    * Modify alarm functions to mask off timer flag
      when clearing (as per datasheet).  This is so clearing
      AF doesn't also clear TF (and visa-versa).
    * Modified time-critical accessor methods to operate from
      buffered values.  This avoids unnecessary i2c calls
      which could put other buffered values out of sync.
    * Fix Wire include + extern definition to work when including
      with other code that uses i2c in a sketch.  Otherwise,
      The Wire library's global 'TwoWire Wire' variable will clash
      when linking.
    Signed-off-by: Chris Evich <>
  3. @cevich

    Update keywords.txt

    cevich authored
    Signed-off-by: Chris Evich <>
  4. @cevich

    Fix get/set date/time race condition

    cevich authored
    A race condition is possible if the real time causes a change in date,
    in-between reading/writing the time then date (separately).  A similar
    race is possible if the date is read, then the time (with the date
    changing in the interval).  This makes it possible to silently corrupt
    the date/time data on the chip.
    The solution is suggested in the datasheet, uses the device's buffering
    & locking the date/time values while reading within once second.
    Therefore, always reading/writing both date and time in one operation,
    completing within 1-second (real time), guarantees all the date/time
    elements will be consistent.
    Added two new functions which perform setting/getting the date and
    time in one single operation.  Also, to help with consistency between
    control registers and date/time values, they are also retrieved
    atomically.  To maintain compatibility with older code, the individual
    date/time set/get functions were modified to simply wrap the new
    functions, by first pre-retrieve the missing values.
    Though the old functions now introduce a (very very) small chance for
    local data corruption (dependent on get/set logic and timing), they're
    guaranteed to never silently corrupt the device's data.  New code should
    make use of the monolithic getDateTime() or setDateTime() functions.
    Signed-off-by: Chris Evich <>
  5. @cevich

    Add support for getting century value

    cevich authored
    Signed-off-by: Chris Evich <>
  6. Merge pull request #7 from Yewess/volt_low

    Support reading & clearing Volt low bit
  7. @cevich

    Add clearVoltLow() member function

    cevich authored
    It doesn't matter if you set the VL_Seconds bit low or
    high, it is always cleared when you write to it.  Added
    a member function that only clears the bit, retaining
    current date/time values.  Made setTime() to mask off
    the VL_Seconds bit, so it's always cleared no matter what.
    Signed-off-by: Chris Evich <>
  8. @cevich

    Add support for retrieving Volt-Low bit

    cevich authored
    * Access to this bit is critical to know whether
      or not the RTC's Vcc dropped below threshold
      and possibly corrupted date/time.  Setting
      the time will automatically clear this bit.
    Signed-off-by: Chris Evich <>
Commits on Nov 6, 2014
  1. Merge pull request #6 from Yewess/fix_setTime

    Fix setTime decl: Remove volt_low param.
  2. @cevich

    Fix setTime decl: Remove volt_low param.

    cevich authored
    This is introduced by another commit and accidentally
    crept over.
    Signed-off-by: Chris Evich <>
Commits on Oct 24, 2014
  1. Merge pull request #5 from Yewess/clean_house

    Fix whitespace, tabs, and newlines
  2. @cevich

    Fix whitespace, tabs, and newlines

    cevich authored
    *  Tab characters where mixed with multiple spaces
       leading to editor/IDE dependent presentation.
       Converted all tabs to 4-space characters.  Aligned
       all misaligned columns and code-blocks for consistency.
    *  Linefeed characters throughout make for messy
       results when changes made in non-Windows
       environment, dependent on editor/IDE.  Removed
       all linefeeds and windows-centric text formatting.
    *  Several places introduced "hidden" whiteapce
       (end of lines, in blank lines, end of file).
       This can result in change-management/diff problems
       and/or sometimes even cause hard-to-find bugs.
       Removed all trailing whitespace.
    Signed-off-by: Chris Evich <>
Commits on Nov 19, 2013
  1. Merge pull request #2 from southwolf/patch-2

    Fix setTime()
  2. @southwolf

    Fix setTime()

    southwolf authored
    Fix setTime(), swap param sec and hour according to the source file
Commits on Nov 6, 2013
  1. Merge pull request #1 from southwolf/patch-1

    Add Serial.begin() to setup
Commits on Nov 1, 2013
  1. @southwolf

    Add Serial.begin() to setup

    southwolf authored
Commits on Mar 2, 2012
  1. TAB->4 spaces

Commits on Feb 28, 2012
  1. Readme

  2. First import

Something went wrong with that request. Please try again.