My current wife and I started our relationship when I was 38. She is my thirds wife. By that age I knew better than to not tell her right away.
My first wife never knew and still doesn't. I told my second wife in the final stages of our marriage when I really had nothing to lose. We divorced and she came out of her own closet and is in a great lesbian relationship for the last dozen years of her life. Current wife and I both struggle with acceptance issues despite the up front warning.