I'm writing a program that have to write every 1.654 seconds (this number is random). The real time I have to wait is calculated and safe in a double type variable. Does anybody know how to make it? I've tried with nanosleep and usleep. But when I try to handle the time variables all goes crazy! Thank for your help.