in reply to epoch time from time()

Very strange indeed. I have no explanation for the big differences in time. I see nothing wrong in the code you post but then again you don't post too much... Could you post the complete code? The only thing I can think of right now is that you accidentally modify $cur_ts somewhere?!