Fixed generateTimestamp method