Using the same rtc object on both .ino file and .cpp file

I'm using a RTC for a test project, and i wanted to use the "rtc" object on both the .ino file and a custom library defined on a .cpp and .h file. For that i wanted to retrieve the pointer of the object present in .ino using this function:

void get_RTC_ptr(RTC_PCF8523* rtc){
  rtc_ptr=rtc;
}

But while i retrieve the local time using the pointer, i get the time that the rtc was initialized rather than the current time, but calling the .now() method on the .ino gives the correct time. Since im a bit out of time right now, does anyone knows an example that uses the RTC the same way i want to use it, or on the contrary, that shows the proper way to implement it?

Thanks in advance, and sorry if details of my problem are only a few.

Post your code. Use Code Tags.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.