## 1 Introduction  
In wireless network systems, the synchronization of device clocks is an important factor, as it allows minimization of the energy use during communication by limiting the amount of time a radio interface operates in listening mode. It also allows synchronizing the data transmitted by different devices. In particular, industrial-based Internet of Things (IoT) installations, especially the ones that monitor complex systems or have strict energy consumption constraints, need an implementation of reliable clock synchronization mechanisms and methods of clock offset and clock skew estimation. The problem of clock skew is a well-documented phenomenon and is not new to scientists, as the clocks providing high accuracy are very expensive and low-cost devices need to operate with time sources having limited accuracy. Many implementations of distributed sensor systems require the nodes to work in a synchronized manner. Battery-operated devices listening for radio messages transmitted by other devices devote a significant amount of energy to listening for incoming transmissions. Idle listening is a dominant source of energy consumption in many wireless communications standards [1, 2]. Most existing protocols, such as the 802.11 power-saving modes (PSMs), attempt to reduce the time spent in idle listening by a sleep schedule. However, in sensor networks and low-power wide area networks (LP WANs), such as Long Range (LoRa) used in direct communication between battery-powered devices, the receiver knows the expected time of the transmission, but does not know the time skew of the transmitted clock. The drift and skew of the transmitter's clock need to be estimated to select the listen ing time window that has a limited duration but assures a very low probability that the transmitter tries to send the message before or after the time when the receiver is listening. The problem of clock synchronization in distributed systems has been heavily analyzed in the literature [3]. Especially in sensor networks, the collected information and measurements need to be merged to assemble a broader picture of the environment, which requires clock synchronization to perform data fusion functions. Clock synchronization functions have been built within many wireless protocols and are provided by cellular networks such as Long Term Evolution (LTE) [4; 5]. Nevertheless, the growing popularity of low-power wide-area networks, such as LoRa, shows that there are still some use cases requiring clock synchronization and clock drift estimation not fully covered in the literature. Although the LoRaWAN protocol includes the function of clock synchronization with the gateways [6], the synchronization between battery-operated devices in LP WAN is still an open challenge. In this paper we focus on sensor networks where smart devices collect measurements in various smart city systems, such as parking space monitoring, energy, water, gas consumption, etc., communicating using LP WAN. Each of these devices sends its measurements to a hub at a certain timestamp. With the inner skew of a quartz clock installed in these devices and other factors like temperature, humidity, etc., every device develops its own unique skew that has to be taken into consideration while collecting its data. Most of the smart devices operate using a battery source, so knowing a precise measurement's time of arrival is crucial for energy-saving and battery longevity. Thus the problem of clock synchronization and skew approximation is challenging and important in such networks. In the IoT sensor systems, both the receiver and the transmitter have their clock shifted, especially the ones exposed to extreme weather conditions, and taking into consideration different skews of different devices increases the complexity of the problem. We concentrate our research on two use cases:  
1. reception of the first packet from a newly deployed device, not synchronized for a longer period of time,
2. continuous clock synchronization and optimization of the listening window's size.