Wistrio LoraWan 5205 and RTC clock

I’m trying to determinate precisely the time an input is high, so I’m using a timer with interrupt that increments each time (1 second) the input is high. Also I write on Flash RAM this value every minute.
To be sure that it is in real time, I connected, in parallel to this input, an external time counter and I noticed a slight shift between the internal timer (STM32) and the external counter (2 minutes every 24 hours).
Looking inside the code, it seems that the basic timer is based on the RTC clock. But how to explain this shift then?
Do you think I could use a more accurate timer?