Fixed MySQL persis problem. Could've been maintenance causing the problem. Have reverted to writing on the fly. I've also fixed a bug in the main loop, so should the hour change, it will write the time (on the hour) and likewise for the first minute in the hour. A stack is being used to log entries that have been inserted to ensure duplications aren't made to the database.