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);
-
1Do you have any idea how huge the DST database is? Work in UTC, and perform the conversion on a bigger machine.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2015年11月20日 07:56:02 +00:00Commented Nov 20, 2015 at 7:56
-
@IgnacioVazquez-Abrams I am logging to FAT, and want to store file times in the usual format.Milliways– Milliways2015年11月21日 01:20:54 +00:00Commented Nov 21, 2015 at 1:20
1 Answer 1
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– Milliways2015年11月21日 01:19:27 +00:00Commented Nov 21, 2015 at 1:19