Real time clock: can not find DS1302RTC class members

I am new to Arduino. I bought a DS1302 real time clock module and want to hook it up to my Arduino Mega. Did not make any physical connections yet.

I attached library (real time clock).

I tried to compile a very tiny sketch to play with the DS1302RTC library.

#include <DS1302RTC.h>

DS1302RTC RTC(31, 33,35); // Set pins:   CE, IO, CLK

void setup() {

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

But I get an error message “t ‘tmElements_t’ has not been declared”. I have no idea …

Thank you very much for your help.


You probably need the time library. If you did install it, you need an include in the beginning of your code

#include <TimeLib.h>

Thank you very much Sterretje. Yhat did the trick