Midi Timestamp Implementation
In general, MIDI recording devices just measure the time when events arrive.

MIDI Clock messages are sent (24 per quarter note) by a sequencer to tell the receiver how the events relate to musical tempo, i.e., they tell where measures are.

MIDI Time Code messages are sent by a sequencer to keep the receiver synchronized to the sender's clock.

If you are generating events in real time, you do not need to do anything of this.