fix #11096: ensure that new %time% directory is unique (rebased from dev_5_0)

Fixes http://trac.openmicroscopy.org.uk/ome/ticket/11096 and https://github.com/openmicroscopy/openmicroscopy/pull/2751#issuecomment-48183153 and substantially refactors the implementation of `%time%`, `%increment%`, `%subdirs%` so re-test according to http://www.openmicroscopy.org/site/support/omero5-staging/sysadmins/fs-upload-configuration.html.

--rebased-from #2773 omitting Ice 3.3 fix