We spent many hours, but could have spent more. I think it is up to the visitor how deeply they want to go into the exhibits and the interest level. My husband has worked in the tech field for decades, so he was very interested in everything. We also enjoyed the special demonstrations and took breaks for lunch and coffee. I think the answer is, you can spend an hour or the whole day...but don't miss this great museum.
2 hours is a good estimate. The demo on the Difference engine took about 1/2 hour alone.
As other mentioned, it depends on your interest and fascination on the subject. 2 hours sound right, but if you take time to read all the facts and listen to all the visit might get much longer.
It depends on your level of interest, however, in terms of how long to stay, but there are plenty of exhibits with detailed information that could easily capture your attention for a few hours. It's a great museum for both children and adults (my partner is a computer scientist) and he found it very interesting.
Get quick answers from Computer History Museum staff and past visitors.