Hi all,
Im trying to write a program that times outputs to parts of the solar cycle (i.e. solar noon, sunrise, sunset, etc.). I installed the time32 library/functionality from What happened to... and am trying to use it with a DS3231 Chronodot RTC. time32 seems to be the successor to the timelord library. I installed the chronodot library from github at GitHub - Stephanie-Maks/Arduino-Chronodot: Chronodot library for the Arduino IDE
The manual with the time32 download says to"
"Set the system time. If using a Clock / Calendar type RTC, fill in the elements of
a struct tm object, setting tm_isdst to zero. Use the result of mktime() as the
system time..."
time_t systime;
struct tm rtctime;
read_rtc(&rtctime); // ‘fills in’ rtctime
systime = mktime( &rtctime );
set_system_time(systime);
I'm a total newbie and have done about a hundred google searches to try and figure out what this means and how to do it. I've read thru the ISO/IEC 9899 at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf (specifically pages 338 to 345). I'm not sure exactly what the struct tm object should contain. Based on what I've read, I guess it might be something like:
#include <studio.h>
#include <time.h>
static const char *const wday[] = {
“Sunday”, “Monday”, “Tuesday”, “Wednesday”,
“Thursday”, “Friday”, “Saturday”, “-unknown-”
}
struct tm time_str;
/* …*/
time_str.tm_year = 2013-1900;
time_str.tm_mon = 7-1;
time_str.tm_mday = 4;
time_str.tm_hour = 0;
time_str.tm_min = 0;
time_str.tm_sec = 1;
time_str.tm_isdst = 0;
the time32 functions run off a Y2K epoch instead of the unix 1/1/70
I don't really know how to do this because Im a real novice. Has any one done this before. Does anyone know where I can find a tutorial on how to do this, or any pertinent info to help figure it out?
TIA for any help offered
-Kevin