Skip to content
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

Module API: Expose clock to get current time #18104

Open
MadLittleMods opened this issue Jan 20, 2025 · 0 comments
Open

Module API: Expose clock to get current time #18104

MadLittleMods opened this issue Jan 20, 2025 · 0 comments

Comments

@MadLittleMods
Copy link
Contributor

Currently, you have to access a private field self.module_api._clock.time_msec() to get the current time when writing a Synapse module. Since accessing underscore private fields is frowned upon, we should have an official pattern for this.

Workaround

I suppose the workaround here is to use the time library but it seems a bit sketchy to use a different time than what Synapse is using (flawed comparisons).

import time

now_ts = int(time.time() * 1000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant