-
Notifications
You must be signed in to change notification settings - Fork 65
[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
[ML] Encapsulate timestamp conversion from epoch seconds to epoch millis #16
Conversation
There was a problem hiding this 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?
lib/core/unittest/CTimeUtilsTest.cc
Outdated
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)); |
There was a problem hiding this comment.
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)
.
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
Good catch. Addressed all points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.