FF 58 04 nn dd cc bb – is the construct of the time signature. So this event lives on the track. Outside on the midi file is the 5th element called ticks_per_beat. This is so the notation of the signature used by musicians is decoupled from tempo. We can still preserve the same structure when we play the file faster or slower so let’s plug in some parameters. Below is example of a file I’m working on, sorry if different from yours. I’ve set the tempo to 110 (different from default) so it ends up in the file.

[Midi File Level]
ticks_per_beat = 120

[Track Level - MIDO]
clocks_per_click = 36
denominator = 4
numerator = 4
notated_32nd_notes_per_beat = 8

I have created a midi file in Ableton with half-notes just so we stay sane and can reverse engineer the math for mido package specific. Just so we’re clear I also assumed 4/4 time signature. You don’t have to worry about hex values everything here above is already decimal (!!)

[Midi File Level]
Ticks Per Beat = Time per beat - Microseconds Per MIDI quarter-note [FF 51 03]
RAW HEX = FF 51 03 05 16 15 - number encoded in last 3 bytes
HEX-0852AF = DEC-545455
1 minute = 60,000,000 microseconds
60,000,000 / 545455 = 109.999908333409722 (float) or 110.00 (with 2 digit accuracy)

[Track Level]
RAW HEX = FF 58 04 04 02 24 08
4th byte - nn - numerator  = 04hex = 2dec -  same
5th byte - dd = denominator = 02hex = 2dec - 2^2 = 4 same
6th byte - cc = clocks_per_click = 24hex and 36dec same
7th byte - bb = notated_32nd_notes_per_beat = 8 same

So just to recap. Midi-level ticks_per_beat are providing very accurate actual time representation. How fast do we want to play your midi structure. Track-level bytes 4-7 of the FF 58 04 message give us musical structure. Decoupled (actual time microseconds, bpms etc) from music structure (bars, quarternotes etc)

Wikipedia has audible example of 4/4 vs 12/8
https://en.wikipedia.org/wiki/Time_signature#Compound

And probably my favourite example
Return to Sauce by Infected Mushroom
https://www.youtube.com/watch?v=fg1WoZOykUI