Added functiont to calc timestamp