It would help if you didn't have 5 to 7 blank lines between each line of code. You'd probably be better off using some sort of timer driven function call back or event setter for the timing. I don't know what these functions are for linux.