Of course don't run that code at midnight!
I use abs(timer -t#) to fudge that a bit, but you need to use 86,400 seconds in a 24-hour day to get code that will adjust properly at midnight for fully reliable timer applications.
So when timer becomes less than t#, which happens right after midnight, t# = t# - 86400.
Pete