Skip to content

Conversation

@kavehshahedi
Copy link
Contributor

What it does

Previously, we used System.nanoTime() to capture the system's timestamp in nanoseconds, which works fine. However, since this method returns the timestamp since the machine's boot, it might not be precise enough to align the trace time with the current actual time. We now capture the offset of System.nanoTime() with the actual system's time, and after that, every captured timestamp will sum up with the offset.

How to test

Just use the ordinary tracing method in your project. From now on, you can see the timestamps are aligned with the system's actual time.

Follow-ups

N/A

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

@kavehshahedi kavehshahedi force-pushed the timestamp-offset branch 2 times, most recently from e5f4b57 to def3fbd Compare February 19, 2025 19:37
Previously, we used System.nanoTime() to capture system's timestamp in
nanoseconds, which works fine. However, since this method returns the
timestamp since the machine's boot, it might not be precise for aligning
the trace time with the current actual time. We now capture the offset
of System.nanoTime() with the actual system's time, and after that,
every captured timestamp will sum-up with the offset.

Signed-off-by: Kaveh Shahedi <kaveh.shahedi@ericsson.com>
@kavehshahedi kavehshahedi merged commit b99a17f into eclipse-tracecompass:main Feb 20, 2025
3 checks passed
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