The duration for Ph.D. in any department depends on the guide under which you are doing your research work. The average duration to produce good quality work with a competent supervisor is 4-5 years. If you get an A grade from all the examiners including foreign examiners, you don’t have to do the Thesis Viva. But a committee is formed by DRC to conduct a viva within IIT Roorkee.
Choosing the guide is a crucial matter for Ph.D. students as the same guide can help you get the degree very quickly while some guides can prolong the duration unnecessarily. Before finalizing your guide, conduct research on his credentials by talking to students he has dealt with in the past. It’s your guide who keeps who assists and motivates you throughout your research work. It’s better to stay away from professors who give C or C+ grades to M.Tech thesis students. This grade reflects nothing but the failure of the guide itself. You can find many such professors in ECE, though I don’t know if these can be found in the CS department or not.
VNIT Nagpur is a better option for CS. The CS department has excellent professors. The labs are well-equipped to carry out research projects. The institute organizes many coding related events throughout the academic year. If you are interested in a professor's area of research, you can approach them about it.