That is pretty common task to generate new files with a timestamp in their names.
It gives you ability to easily identify them, sort them and make them pretty unique.
However, if you have a very busy process it is possible that duplicate name will be produced and you might loose some data.
To avoid that situation I’ve came up with following solution.
It is difficult to envision this solution going wrong.