Skip to content

Add Integration Test for Timestamp Behavior - #341

Open
KonradBreitsprecherBkd wants to merge 4 commits into
mainfrom
dev/Itest_timestamps
Open

Add Integration Test for Timestamp Behavior#341
KonradBreitsprecherBkd wants to merge 4 commits into
mainfrom
dev/Itest_timestamps

Conversation

@KonradBreitsprecherBkd

Copy link
Copy Markdown
Contributor

The timestamp behavior had no integration test. The test covers:

Verify timestamp behavior from the synchronized participant perspective:

  • Sync sender: outgoing event carries virtual send time.
  • Async sender: outgoing events will have an invalid timestamp
  • Sync receiver: incoming event from async or sync sender is timestamped with sync receive time.
  • Async receiver: incoming event from async or sync sender keeps the timestamp (async sender: invalid timestamp, sync sender: send time)

Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
@KonradBreitsprecherBkd KonradBreitsprecherBkd changed the title Add integration test for timestamp behavior Add Integration Test for Timestamp Behavior Jun 15, 2026
@KonradBreitsprecherBkd KonradBreitsprecherBkd added the needs reviewer This issue is looking for a reviewer. label Jun 15, 2026
@snps-fiodorov
snps-fiodorov requested review from snps-behrens and removed request for snps-fiodorov July 29, 2026 09:24
@snps-fiodorov snps-fiodorov removed the needs reviewer This issue is looking for a reviewer. label Jul 29, 2026

@snps-behrens snps-behrens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify. I understood the timestamp behavior implementation in the sync -> sync situation to be that the send time (not the receive time) is used. If it were otherwise, wouldn't NetworkSimulator timestamps be overwritten?

The documentation seems to agree with me (though it is not explicilty stated): https://vectorgrp.github.io/sil-kit-docs/simulation/simulation.html#timestamps-in-messages.

@KonradBreitsprecherBkd

Copy link
Copy Markdown
Contributor Author

Just to clarify. I understood the timestamp behavior implementation in the sync -> sync situation to be that the send time (not the receive time) is used. If it were otherwise, wouldn't NetworkSimulator timestamps be overwritten?

The documentation seems to agree with me (though it is not explicilty stated): https://vectorgrp.github.io/sil-kit-docs/simulation/simulation.html#timestamps-in-messages.

You're right, the logic is (taken from the code):

template <typename MsgT>
void SetTimestamp(MsgT& msg, std::chrono::nanoseconds value, std::enable_if_t<HasTimestamp<MsgT>::value, bool> = true)
{
    if (msg.timestamp == std::chrono::nanoseconds::duration::min())
    {
        msg.timestamp = value;
    }
}

This is: "On reception of a msg with an invalid timestamp (==from async), overwrite it with the local now() of the receiver"

So the comment above the test is misleading:
- Sync receiver: incoming event from async or sync sender is timestamped with sync receive time.
Also the SyncSubFromSync evaluation is off then.
Good catch, will rework!

…ments

Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants