went on a commenting binge, based on Mediawiki's coding conventions
moved globals inside TimeGate into constructor so they could be controlled from one place, using member variables instead; this is not the preferred solution, but it is a step on the path to replacing the globals with hooks, if possible