Skip to content

Commit c7bb501

Browse files
authored
Convert time from eventPropertiesto ticks (#1165)
1 parent b2a54a6 commit c7bb501

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/decorators/EventPropertiesDecorator.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ namespace MAT_NS_BEGIN {
116116

117117
auto timestamp = eventProperties.GetTimestamp();
118118
if (timestamp != 0)
119-
record.time = timestamp;
119+
// convert timestamp in millis to ticks and add ticks for UTC time 0.
120+
record.time = timestamp * 10000 + 0x89F7FF5F7B58000ULL;
120121

121122
record.popSample = eventProperties.GetPopSample();
122123

tests/unittests/EventPropertiesDecoratorTests.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TEST(EventPropertiesDecoratorTests, Decorate_SetToEventPropertiesTimestamp)
7676
EventLatency latency = EventLatency::EventLatency_Normal;
7777

7878
EXPECT_TRUE(decorator.decorate(record, latency, props));
79-
EXPECT_THAT(record.time, Eq(1234567));
79+
EXPECT_THAT(static_cast<unsigned long long>(record.time), Eq(1234567ULL*10000 + 0x89F7FF5F7B58000ULL));
8080
}
8181

8282
TEST(EventPropertiesDecoratorTests, Decorate_PopSample)

0 commit comments

Comments
 (0)