I don't know what topsites is but ...
if you are saving your hits in a database I'd put a column in for date and only increment if the data matches.
Your script would identify how many rows were updated, should be 1. If 0 then insert a new row as this must be the first hit of the day.
Why is this better: because you have your hit history saved and no need for cron jobs etc.