NiVO / BY TECHNOGISGermany · Indonesia
Telemetry time tutorial

MAVLink SYSTEM_TIME: Separate Boot Time from Unix Time in a Drone Log

Read the two SYSTEM_TIME fields with their declared origins and units, split integer timestamps exactly, and keep representation checks separate from clock synchronization.

MAVLink SYSTEM_TIME: Separate Boot Time from Unix Time in a Drone Log

Identify the field before interpreting its timestamp

A drone log review can bring together timestamps from telemetry, imagery, and the receiving computer. Similar-looking numbers do not establish that these records use the same clock. MAVLink SYSTEM_TIME is a useful example because a single message includes a Unix-epoch timestamp and a timestamp measured since system boot. Applying the same conversion to both fields can produce a plausible-looking but incorrect timeline. Start with the message definition, field name, sender identity, and units before comparing anything to a photograph or another log.

This tutorial takes two already decoded, constructed field values and separates their whole seconds from their subsecond remainders using integer arithmetic. It does not connect to a drone, decode MAVLink packets, establish camera exposure times, or synchronize any device. The example is an explanation of representation, rather than a measured NiVO clock result. The product photograph is separate context. A successful output demonstrates that the two supplied integers were decomposed consistently; it provides no independent evidence that either source clock was correct.

Keep the two origins and units explicit

The current MAVLink common definition identifies SYSTEM_TIME as message number two. Its time_unix_usec field is an unsigned sixty-four-bit Unix-epoch timestamp in microseconds. Its time_boot_ms field is an unsigned thirty-two-bit timestamp in milliseconds since system boot. These declarations already identify the origins; this is not a field where the reader must guess epoch versus boot time from numeric magnitude. Retain the original names when exporting the decoded values so that an abbreviated time column does not erase this distinction.

The message description refers to the sender master clock and allows different components in a MAVLink network to emit the message. Therefore, preserve system and component identity from the surrounding recording when associating time evidence. Do not assume that every received SYSTEM_TIME row represents one flight controller or one uninterrupted boot session. The specification also directs precise synchronization needs to TIMESYNC. Merely placing two clocks in one message does not turn this tutorial into a clock-offset estimator, a latency measurement, or proof of precise alignment across devices.

NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors
NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors.Source: NiVO / TechnoGIS catalogue materials supplied by the site owner · Catalogue photo
Product context only; this photograph does not depict the constructed examples in this article.

Split decoded integers without losing the remainder

Run the following function locally with Python. It accepts only actual integers within the declared unsigned field ranges; Boolean values, decimal strings, floating-point values, and negative numbers are rejected. Python divmod returns an integer quotient and remainder for integer arguments. Dividing the Unix field by one million produces whole epoch seconds and remaining microseconds. Dividing the boot field by one thousand produces whole seconds since boot and remaining milliseconds. The returned keys preserve both the origin and the scale of each remainder.

For the constructed values below, the Unix result is 1700000000 whole seconds plus 123456 microseconds. The boot result is twelve whole seconds plus 345 milliseconds. Neither number is presented as a captured flight timestamp. Keeping the remainder as an integer avoids rounding it away through an intermediate floating-point seconds value. The function deliberately produces no formatted calendar date, local timezone conversion, boot date, or correspondence with a second recording. Those operations need additional context beyond this small field decomposition.

def split_system_time(time_unix_usec, time_boot_ms):
    fields = ((time_unix_usec, 64), (time_boot_ms, 32))
    if any(type(value) is not int or not 0 <= value < (1 << bits)
           for value, bits in fields):
        raise ValueError("Expected decoded uint64 microseconds and uint32 milliseconds")
    unix_seconds, unix_microseconds = divmod(time_unix_usec, 1_000_000)
    boot_seconds, boot_milliseconds = divmod(time_boot_ms, 1_000)
    return {"unix_seconds": unix_seconds,
            "unix_microseconds": unix_microseconds,
            "boot_seconds": boot_seconds,
            "boot_milliseconds": boot_milliseconds}

# Constructed SYSTEM_TIME field values, not a flight observation.
print(split_system_time(1_700_000_000_123_456, 12_345))

Preserve zero values and discontinuities without inventing meaning

The SYSTEM_TIME field declarations read for this exercise do not assign a special unavailable marker to either field. The function therefore retains zero numerically rather than silently converting it into missing data. That behavior does not certify that a zero epoch value represents a trustworthy clock in an actual recording. If a particular implementation supplies an additional initialization or validity policy, document that policy from the implementation evidence. Keep the raw field and the interpretation separate instead of importing a sentinel rule from a different MAVLink message.

Similarly, a smaller boot-time value in a later received row deserves investigation rather than an automatic conclusion that the aircraft restarted. Sender changes, recording boundaries, ordering, implementation behavior, and the finite width of the field may matter. This function handles individual decoded rows and makes no decision about continuity or rollover between them. Preserve packet or record order and the source identity before testing a sequence. A discontinuity classification should state its evidence and limits, rather than being inferred solely because a converted seconds value decreased.

Do not turn a representation check into synchronization evidence

Converting both fields into the same unit is useful for understanding their scales, but it does not remove their different origins. Subtracting boot time from epoch time can tempt a reviewer to assign an exact wall-clock instant to every boot-relative record. That inference needs a justified association model and evidence about the clocks and recording. The small function here deliberately does not calculate such an anchor. It also does not measure when the receiving computer observed the message or when any image exposure occurred.

For an actual timing investigation, identify which independent question needs answering: field conversion, sender continuity, clock synchronization, or alignment with a camera event. These questions require different evidence. Retain the decoder revision and the message-definition version because an exported column may already have been converted by another tool. Repeating a microseconds-to-seconds conversion on a seconds-valued export creates a new error rather than improving precision. Check the export contract and a known raw row before applying arithmetic to an entire log collection.

Check the arithmetic independently by multiplying unix_seconds by one million and adding unix_microseconds; the original Unix integer must be recovered exactly. Apply the corresponding one-thousand calculation to the boot result. Test a value just below a whole-second boundary and the value at that boundary to expose accidental truncation or scale confusion. The remainder must stay below its divisor. These are representation invariants that can be verified without a calendar library or a live connection, and they remain distinct from any claim about real event timing.

Deliver a time interpretation that another reviewer can reproduce

A useful time-review note includes the unchanged recording identity, sender information, message and field names, raw integers, declared origins and units, conversion method, and the resulting quotient and remainder. Include one small independently checked row and identify which subsequent timing questions remain open. If the result is only an exact decomposition, call it that. Do not label it a synchronized timeline, a camera geotag correction, or a validated survey time merely because the converted numbers have a familiar scale.

In a NiVO-related telemetry handoff, this approach makes clock assumptions visible before they influence image matching or other downstream work. The practical gain is a clear boundary between reading the recorded representation and establishing a relationship among real events. Preserve original values and continue any required synchronization or operational analysis through the appropriate project method. A reviewer should be able to reconstruct both input integers from the delivered whole seconds and remainder, while also seeing that no independent clock accuracy or flight outcome was established by this exercise.

Technical references

  1. MAVLink common.xml: SYSTEM_TIME origins, units and synchronization scope ↗
  2. Python divmod: integer quotient and remainder ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team