The old fashioned mechanical way is like the odometer on a car. It is run off a cable and counts engine revolutions. The ones I have seen say something like "hours at 2700 rpm" so it is only a rough estimate.
Newer and larger tractors have an engine oil pressure switch in the circuit. Depending on the brand many tractors were equipped with these starting about in the 60's. The hour meter is a digital timer that only gets power when the engine oil pressure exceeds a certain level, usually about 5 psi.
More modern and larger tractors get engine hours from the engine ECM - computer. Some use the engine oil pressure switch to run the display the operator sees but the engine ECM clock can only be read by having the proper software and connecting to the engine ECM buss. The ECMs with which I am familiar start counting time after the engine reaches a certain rpm.
We have 3 Kubotas. The RTV has only a timer connected to the key switch. Switch on, hours are counting even if the engine isn't turning over. Our L5740 has an oil pressure switch controlled timer. Our M135GX is fed from one of 3 computers. It tracks days, how many hours it ran that day, and how much fuel it used during those hours.
Sounds like your tractor has the oldest style, the cable. That's a bit surprising because an idle hour counts for only a half hour. Even my cheapo John Deere riding mower has a pressure switch digital hour meter.