1

I am using a Uno as a data logger with a DS1307 RTC and the following libraries Time.h DS1307RTC.h

The DS1307 does not have any support for DST and neither library includes Time Zone.

Are there any libraries which adjust for DST?


I used the Timezone module to correct my times for DST. It took a little time to sort it out, so I though I would post the steps I followed.

Customise WriteRules for my Timezone. I copied rule from WorldClock. NOTE also need to modify Timezone in setup(void) Run WriteRules.pde to write rules to EEPROM address 100

Run TimeRTCSet.pde to set RTC time to UTC. Start Serial Monitor. In Terminal send time to Arduino

date -u +T%s > /dev/tty.usbmodemFA131 

Run HardwareRTC.pde to demonstrate time display in UTC & local

I modified my sketch by including the following code:-

#include <Timezone.h>    //https://github.com/JChristensen/Timezone
⋯
Timezone myTZ(100);       //assumes rules stored at EEPROM address 100
TimeChangeRule *tcr;        //pointer to the time change rule, use to get TZ abbrev
time_t utc, local;
⋯
utc = now();
local = myTZ.toLocal(utc, &tcr);
  • 1
    Do you have any idea how huge the DST database is? Work in UTC, and perform the conversion on a bigger machine. – Ignacio Vazquez-Abrams Nov 20 '15 at 7:56
  • @IgnacioVazquez-Abrams I am logging to FAT, and want to store file times in the usual format. – Milliways Nov 21 '15 at 1:20
3

You could use the Timezone library.

  • The HardwareRTC appears to be what I am looking for. I will use WriteRules to store my time zone in EEPROM. – Milliways Nov 21 '15 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.