29 lines
625 B
Plaintext
29 lines
625 B
Plaintext
TIME_TO_SYNC = 100
|
|
sync_timer = 0
|
|
timesync_old_state = 0
|
|
timesync_itr = 0
|
|
timesync_state = 0
|
|
|
|
# Function to sync. algo
|
|
function check_time_sync(){
|
|
# sync_timer = sync_timer + 1
|
|
# if(sync_timer < TIME_TO_SYNC){
|
|
# log(" Synchronizing Clock : ",sync_timer,"/",TIME_TO_SYNC)
|
|
# timesync_state = 1
|
|
# }
|
|
# else{
|
|
# timesync_state = 0
|
|
# }
|
|
# if(timesync_old_state == 0 and timesync_state == 1){
|
|
# timesync_itr = timesync_itr + 1
|
|
# timesync_old_state = 0
|
|
# }
|
|
# timesync_old_state = timesync_state
|
|
}
|
|
|
|
# Function to set sync timer to zero and reinitiate sync. algo
|
|
|
|
function reinit_time_sync(){
|
|
sync_timer = 0
|
|
}
|