If you program a microcontroller to count the number of pulses in a second, and it's wrong. It's either counting the number of pulses incorrectly, or it isn't accurately estimating the passing of a second. I'm willing to bet it's the later.
To measure time accurately, your microcontroller's clock source either needs to be accurate (crystal source) or needs to be compensated (how many clock cycles are actually in a second VS rated approximation of microcontroler's internal clock).
If your pulse width is proportional to the frequency, you can use something similar to this:
The timer starts on rising edge and captures on falling edge. the Capture interrupt has the results. You have a 1 microsecond accuracy.
If you need to capture from rising pulse to rising pulse, then put a flip flop in there that sends Q NOT into D, and the rising edge will send Q high. Send that into counter enable. The next rising edge will send Q low, disabling the counter. You can capture the count using Q Not into Capture (capture on rising edge), interrupt on capture, then read the capture register. I found out through experimentation that capture works on a counter with enable low, which is why Q NOT can give you the counter capture.
Be sure and put this in, then build, then put any USB onto the schematics after a successful build and run, else you can end up with routing issues, with sporadic capture interrupts. (Based on experience with with 6 or more identical counters in the schematic page with USB placed on the page first.)