RTCZero and TimeLib conflict

Has anyone had issues with these two libraries working together on the MKR1000? I get a bunch of compile errors, even in an otherwise empty sketch, regardless of order. Is this a function conflict issue?

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp: In member function 'uint32_t RTCZero::getEpoch()':

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:365:13: error: aggregate 'RTCZero::getEpoch()::tm tm' has incomplete type and cannot be defined

struct tm tm;

What I'm trying to do is convert the UNIX time from WiFi101 to conventional time used in the RTCZero libraries.

Thanks in advance -

Hi,
do you have the latest verision of IDE , RTCZERO and SAMD library?
Can you please post here your sketch and verbose build log?

IDE 1.8.1
SAMD 1.6.11
RTCZero 1.5.1
Time 1.5.0

#include <RTCZero.h>
#include <TimeLib.h>
void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}

Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino MKR1000”

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp: In member function ‘uint32_t RTCZero::getEpoch()’:

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:365:13: error: aggregate ‘RTCZero::getEpoch()::tm tm’ has incomplete type and cannot be defined

struct tm tm;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:377:20: error: ‘mktime’ was not declared in this scope

return mktime(&tm);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp: In member function ‘void RTCZero::setAlarmEpoch(uint32_t)’:

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:31: error: ‘gmtime’ was not declared in this scope

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:395:21: error: invalid use of incomplete type ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

setAlarmDate(tmp->tm_year - EPOCH_TIME_YEAR_OFF, tmp->tm_mon + 1, tmp->tm_mday);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:12: error: forward declaration of ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:395:57: error: invalid use of incomplete type ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

setAlarmDate(tmp->tm_year - EPOCH_TIME_YEAR_OFF, tmp->tm_mon + 1, tmp->tm_mday);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:12: error: forward declaration of ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:395:74: error: invalid use of incomplete type ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

setAlarmDate(tmp->tm_year - EPOCH_TIME_YEAR_OFF, tmp->tm_mon + 1, tmp->tm_mday);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:12: error: forward declaration of ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:396:21: error: invalid use of incomplete type ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

setAlarmTime(tmp->tm_hour, tmp->tm_min, tmp->tm_sec);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:12: error: forward declaration of ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:396:35: error: invalid use of incomplete type ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

setAlarmTime(tmp->tm_hour, tmp->tm_min, tmp->tm_sec);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:12: error: forward declaration of ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:396:48: error: invalid use of incomplete type ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

setAlarmTime(tmp->tm_hour, tmp->tm_min, tmp->tm_sec);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:393:12: error: forward declaration of ‘struct RTCZero::setAlarmEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp: In member function ‘void RTCZero::setEpoch(uint32_t)’:

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:31: error: ‘gmtime’ was not declared in this scope

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:410:36: error: invalid use of incomplete type ‘struct RTCZero::setEpoch(uint32_t)::tm’

RTC->MODE2.CLOCK.bit.YEAR = tmp->tm_year - EPOCH_TIME_YEAR_OFF;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:12: error: forward declaration of ‘struct RTCZero::setEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:411:37: error: invalid use of incomplete type ‘struct RTCZero::setEpoch(uint32_t)::tm’

RTC->MODE2.CLOCK.bit.MONTH = tmp->tm_mon + 1;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:12: error: forward declaration of ‘struct RTCZero::setEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:412:35: error: invalid use of incomplete type ‘struct RTCZero::setEpoch(uint32_t)::tm’

RTC->MODE2.CLOCK.bit.DAY = tmp->tm_mday;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:12: error: forward declaration of ‘struct RTCZero::setEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:413:36: error: invalid use of incomplete type ‘struct RTCZero::setEpoch(uint32_t)::tm’

RTC->MODE2.CLOCK.bit.HOUR = tmp->tm_hour;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:12: error: forward declaration of ‘struct RTCZero::setEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:414:38: error: invalid use of incomplete type ‘struct RTCZero::setEpoch(uint32_t)::tm’

RTC->MODE2.CLOCK.bit.MINUTE = tmp->tm_min;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:12: error: forward declaration of ‘struct RTCZero::setEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:415:38: error: invalid use of incomplete type ‘struct RTCZero::setEpoch(uint32_t)::tm’

RTC->MODE2.CLOCK.bit.SECOND = tmp->tm_sec;

^

C:\Users\Dave\Documents\GitHub\Arduino\libraries\RTCZero\src\RTCZero.cpp:408:12: error: forward declaration of ‘struct RTCZero::setEpoch(uint32_t)::tm’

struct tm* tmp = gmtime(&t);

^

exit status 1
Error compiling for board Arduino/Genuino MKR1000.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Hi @dwine66,

Unfortunately the libraries are not compatible since, TimeLib contains a Time.h file and RTCZero.h depends on the POSIX time.h header. Since Windows has a case insensitive filesystem, Timelib's time.h conflicts.