build: only manipulate out if getting the timestamp was successful

This fixes an issue seen in #1548, though the real problem is something
different.