Skip to content

Adds RM_Microseconds and RM_CachedMicroseconds#11016

Merged
oranagra merged 4 commits intoredis:unstablefrom
guybe7:rm_time
Jul 27, 2022
Merged

Adds RM_Microseconds and RM_CachedMicroseconds#11016
oranagra merged 4 commits intoredis:unstablefrom
guybe7:rm_time

Conversation

@guybe7
Copy link
Collaborator

@guybe7 guybe7 commented Jul 20, 2022

RM_Microseconds
Return the wall-clock Unix time, in microseconds

RM_CachedMicroseconds
Returns a cached copy of the Unix time, in microseconds.
It is updated in the server cron job and before executing a command.
It is useful for complex call stacks, such as a command causing a
key space notification, causing a module to execute a RedisModule_Call,
causing another notification, etc.
It makes sense that all these callbacks would use the same clock.

RM_Time
Return the wall-clock Unix time, in microseconds

RM_CachedTime
Returns a cached copy of th Unix time, in microseconds.
It is updated in the server cron job and before executing a command.
It is useful for complex call stacks, such as a command causing a
key space notification, causing a module to execute a RedisModule_Call,
causing another notification, etc.
It makes sense that all this callbacks would use the same clock.
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

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

API LTGM.
@redis/core-team please approve

@guybe7 guybe7 changed the title Adds RM_Time and RM_CachedTime Adds RM_Microseconds and RM_CachedMicroseconds Jul 20, 2022
Copy link
Member

@itamarhaber itamarhaber left a comment

Choose a reason for hiding this comment

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

LGTM

@oranagra oranagra merged commit 45c99d7 into redis:unstable Jul 27, 2022
@oranagra oranagra added state:major-decision Requires core team consensus release-notes indication that this issue needs to be mentioned in the release notes labels Jul 27, 2022

/* Return the current UNIX time in milliseconds. */
long long RM_Milliseconds(void) {
mstime_t RM_Milliseconds(void) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was looking at some calls to mstime() and saw this.
do we also need a RM_CachedMilliseconds that will return server.mstime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One can use CachedMicroseconds and divide by 1000

enjoy-binbin pushed a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
RM_Microseconds
Return the wall-clock Unix time, in microseconds

RM_CachedMicroseconds
Returns a cached copy of the Unix time, in microseconds.
It is updated in the server cron job and before executing a command.
It is useful for complex call stacks, such as a command causing a
key space notification, causing a module to execute a RedisModule_Call,
causing another notification, etc.
It makes sense that all these callbacks would use the same clock.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes state:major-decision Requires core team consensus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants