Daily counter

Hi! I need to make a counter that reset itself every day. Do you have any suggestion on how to make it? thanks!

Convert the output from time() or clock() to seconds, and reset your counter when the current converted value is smaller then the previous converted value, might do the trick?

date() also is useful here, as you can look for midnight quite easily.