improve auto-timestamp, add tests provided by @rgooding