I worked for many years in many different restaurants and commercial kitchens. Early in my career I would ask how long something should cook for, and the answer would invariably be "until it is done." I soon stopped asking the question.
Seriously, though, the real question here is "How do I know when a ham is done?" There are two main ways of telling when ham - or most any non-red meat such as pork or poultry - is done. If you pierce it with a fork, and the juices run clear then the meat is done.
I don't like to do that; if it is not close enough to being done when you pierce the meat, too much of the juice runs out and you are left with a dry piece of meat. A better way is to use an accurate cooking thermometer.
If you are making a prepared ham, you aren't really cooking it - it is fully cooked when it is packaged. What you are doing is heating the meat so that whatever sauce and seasoning you have added can "cook in." For this type of ham, I would bake it to an internal temperature of about 125 degrees Fahrenheit.
If you are using a "fresh ham", then you are indeed actually cooking it. There are many ways to prepare this type of ham. You can rub it with some olive oil and whatever spices you like, then roast it with the vegetables right there in the pan with the ham.
Roast it until your meat thermometer registers 150 degrees Fahrenheit. Take the ham out of the oven, cover it with a clean kitchen towel, and let it rest for 15 minutes. This lets the juices in the meat re-distribute and allows the heat still in the meat to finish the cooking process.
Don't carve any meat straight out of the oven. The juices will all run out. The good news is you will have enough stock to make about a gallon of gravy. The bad news is you will be putting a very dry roast on your table.
You can also cook a fresh ham like a corned beef. The cut known as the "Pork Shoulder Picnic" is good for this. It is an inexpensive yet flavorful cut that stands up well to this method of cooking. It is a one-pot meal, and doesn't require a lot of constant attention while it cooks.
Put the ham in a big pot with enough water to cover. Add whatever spices you like, along with some aromatic vegetables such as onion, carrot, celery, and garlic. Also add whatever herbs you like. I recommend basil, bay leaf, whole mustard seed, pepper, and a little cayenne for a bit of extra fire.
Bring all this to a boil, reduce the heat, and simmer for about an hour and a half. Of course, the time will vary based on the size of the ham, how big the pot is, and how much water is in the pot.
When the ham is a uniform light brown color on the outside - that is, when the entire outside of the ham is no longer pink - add some fairly large pieces of cut-up potatoes. With this method of cooking, it is okay to stick a fork into the meat to test how done it is - just don't do it too many times.
When a large cooking fork goes all the way into the meat without much resistance, it's ready for the potatoes. Simmer until poking a small, sharp knife goes into the potato fairly easily.
Then add the vegetables that will cook fast: Leafy greens, cabbage, some fresh or frozen green beans, whatever you like and happen to have handy in your fridge or freezer. Don't overcook these vegetables. Take them out of the pot and put them into a serving bowl as soon as you see the color of the vegetables brighten and they are still firm to the bite. A little crunch is good.
Check the temperature with your meat thermometer. Push it gently into the thickest part of the ham. You are looking for an internal temperature of 150 degrees Fahrenheit.
Follow the resting instructions for the oven-roasted ham, and remember not to carve any meat right out of the oven or pot. Resting lets the juices in the meat settle back deep into the meat where they started, and allows the residual heat to finish cooking the ham.
Put the vegetables in serving bowls, and keep the liquid. It is not exactly perfect soup stock, but it is great for cooking beans or making split pea soup. Just follow the package directions for whatever kind of beans or peas you are using, and use the ham stock for the cooking liquid. YUM!
I hope these tips and hints prove useful.