Incipient magnetism in the cubic perovskites MgCNi3 and YBRh3: A comparison