Fix on time column definition

Storing 4 digits total with 2 after the decimal prevented 100% from
being stored, changed the definition to 5 digits total
Simplified connecting to the program database

Created a function that returns a connection to the database, instead of
loading the database configuration a bunch of times.
Also opened a new connection to the database when starting a new day,
which should fix the MySQL server has gone away errors