time_circuit: update time code to be able to handle dates from 0 to 9999

Note it is not smart enough to handle the gregorian to julian transition.
But it should handle leap years OK.
time_circuit: update to allow entering new time format