fix calculation of milliseconds

The previous method of appending 000 to the timestamp string failed for the
start of the epoch which became '0000' rather than just '0'.