Skip to content

[ML] Encapsulate timestamp conversion from epoch seconds to epoch millis #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2018
Merged

[ML] Encapsulate timestamp conversion from epoch seconds to epoch millis #16

merged 2 commits into from
Mar 14, 2018

Conversation

dimitris-athanasiou
Copy link
Contributor

No description provided.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

Does CModelSnapshotJsonWriter.cc need updating too?

CPPUNIT_ASSERT_EQUAL(ml::core::CTimeUtils::toEpochMs(ml::core_t::TTime(1)), int64_t(1000));
CPPUNIT_ASSERT_EQUAL(ml::core::CTimeUtils::toEpochMs(ml::core_t::TTime(-1)), int64_t(-1000));
CPPUNIT_ASSERT_EQUAL(ml::core::CTimeUtils::toEpochMs(ml::core_t::TTime(1521035866)), int64_t(1521035866000));
CPPUNIT_ASSERT_EQUAL(ml::core::CTimeUtils::toEpochMs(ml::core_t::TTime(-1521035866)), int64_t(-1521035866000));
Copy link
Contributor

Choose a reason for hiding this comment

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

The order of arguments should be (expected, actual).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I was testing you :P

@@ -400,8 +406,7 @@ class CRapidJsonWriterBase : public JSON_WRITER<OUTPUT_STREAM, SOURCE_ENCODING,
core_t::TTime value,
TValue &obj) const
{
int64_t javaTimestamp = int64_t(value) * 1000;
TValue v(javaTimestamp);
TValue v(CTimeUtils::toEpochMs(value));
Copy link
Contributor

Choose a reason for hiding this comment

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

Lower down this file, around line 550-555 value * int64_t(1000) can also be changed.

@dimitris-athanasiou
Copy link
Contributor Author

Good catch. Addressed all points.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

LGTM

@dimitris-athanasiou dimitris-athanasiou merged commit 7603890 into elastic:master Mar 14, 2018
@dimitris-athanasiou dimitris-athanasiou deleted the encapsulate-timestamp-conversion-from-epoch-seconds-to-epoch-millis branch March 14, 2018 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants