Always leave extra time.
A lecturer I know spent 6 weeks on it, I know someone who took 6 years.
I'm in my 4th year and still writing and started early in my 4th year. I could go on indefinately, I can always improve on it.
I would guess 6 months, but it depends how motivated you are, if you're working at the time, if you've analysed already for papers, how much of a perfectionist you are, how good you are at writing, and how quick your supervisor reads drafts.
I've heard it's not a good idea to work at the same time as write-up as some people don't finish.