linkrefa.blogg.se

Freefilesync pause after x hours
Freefilesync pause after x hours








A general solution that will allow a desired loop duration greater than an hour can simply split the desired duration over multiple inner loops, each less than an hour.

freefilesync pause after x hours

The checks for midnight rollover and Daylight Savings change are easy to implement if it can be assumed that the loop duration is less than an hour. The TIMEOUT command can be used for the pauses to minimize cpu overhead.Ĭomplications that need to be tested each loop are midnight rollover (in which case 86400 seconds must be subtracted from Desired Loop Endtime) and changes to or from Daylight Savings Time (in which case 3600 seconds must be added to or subtracted from Desired Loop Endtime).

freefilesync pause after x hours

(During initialization before the first loop begins, set Desired Loop Endtime to the current time.) This scheme ensures that for all N, the total time to execute N loops will be within one second of the desired total amount of time (N x DesiredLoopDuration). At the beginning of each loop, the desired loop duration (10 seconds or whatever) should be added to the previous Desired Loop Endtime. In a correct solution, each loop must calculate the number of seconds to pause after it's finished executing the loop's workload, by subtracting the current time from the Desired Loop Endtime.

#Freefilesync pause after x hours plus#

All of the previous answers are flawed: Instead of making each loop take 10 seconds, they cause each loop to take 10 seconds plus the execution time of the desired workload.








Freefilesync pause after x hours