It seems unlikely that an ovoviparous ancestor of mammals long ago could have had a viviparous offspring in a sharp one-generation dividing line, but what would be the gradual steps between egg birth and live birth? Are there any examples of answers to the first question today? It seems that marsupials are a different thing altogether, not something in between egg laying and live birth (no modern mammal's ancestors aren't believed to have marsupial-style birth in their evolutionary history, right?)?
I happen to have seen a talk by an anthropologist who was working on this (i can't reference them here i'm sorry to say - forgotten her name). I can only give an example from their work...
If you look at old world and new world primates, there is a large difference between the gestation time. If you look at the table in the link, lemurs have half the gestation time that humans and gorillas have.
What I can recall is that the lemurs placenta lacks many of the structures that primates have (see section 5). The lemur placenta is supposed to be primitive and a lot more like an egg sac which was internalized as opposed to a more articulated womb that primates have. So her thesis was that eggs would start out being internalized and subsisting only on their own internal structures, still isolated from the mother, then later placental structures would come about that nourish the fetus and enable it to enjoy longer gestation and better development pre-partum.
The stage I'm describing is only the divergence between primitive wombs and 'more advanced' wombs in the sense that they were capable of supporting the fetus for 9 months rather than just 4. That development happened over about 30 million years. The divergence of mammals is thought to have happened about 270 million years ago.
So the rough answer would be hundreds of millions of years for the whole shebang, but internalized eggs and live birth would be a relatively smaller amount of time.