'How to synchronize time-shifted in R?

I have some data from meteorological observatory, but it contains some problem. Due to the fact that the sensors do not always work stably, there was some shift in time. Here's what it roughly looks like:

       `REF DATE-TIME`         `DATE-TIME` CO2_dry CH4_dry   H2O
1 2020-09-27 00:00:00 2020-09-27 00:00:00     416.    2.1   1.64
2 2020-09-27 00:00:05 2020-09-27 00:00:05     416.    2.10  1.64
3 2020-09-27 00:00:09 2020-09-27 00:00:10     416.    2.10  1.63
4 2020-09-27 00:00:14 2020-09-27 00:00:15     416.    2.10  1.64
5 2020-09-27 00:00:19 2020-09-27 00:00:21     417.    2.10  1.64
6 2020-09-27 00:00:24 2020-09-27 00:00:23     416.    2.10  1.63
*** (switched off for 6 minutes)
7 2020-09-27 00:00:25 2020-09-27 00:06:26     416.    2.10. 1.63

In a few words: when the device was turned on after a malfunction, it began to count the time taking into account how much it had not worked. But I have a reference date-time column and this two columns are shifted, so I nave to synchronize them. A spread in values ​​​​of 3-6 milliseconds can be considered normal. How I can synchronize the data? It is so important for research, but I have no clue how to make it :(



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source