-
Notifications
You must be signed in to change notification settings - Fork 37
Get current time with milliseconds precision. #523
Get current time with milliseconds precision. #523
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.
Could you add some tests?
@@ -278,6 +271,17 @@ class TimeUtils { | |||
|
|||
static Timezone globalTimezone; | |||
|
|||
struct UnixTime { | |||
int64_t seconds{0}; | |||
int64_t milliseconds{0}; |
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.
here is microseconds
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.
Milliseconds in fact.
|
||
// <seconds, milliseconds> | ||
static UnixTime unixTime() { | ||
auto ms = WallClock::fastNowInMilliSec(); |
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.
you can use fastNowInMicroSec
directly
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 cypher only provide the milliseconds precision
Can't know the current time number, so no better way to compare it. |
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
Close vesoft-inc/nebula-graph#830