fixed bug of timer (incorrect record sleep duration into database)