Skip to content

Commit

Permalink
Add method to get current server time in milliseconds in ModuleApi (#…
Browse files Browse the repository at this point in the history
…18144)

- Add `get_current_time_msec()` method to the [module
API](https://matrix-org.github.io/synapse/latest/modules/writing_a_module.html)
for sound time comparisons with Synapse.
- Fixes #18104 

Signed-off-by: Ahmed Qashlan <ahmedelqashlan@gmail.com>
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
Co-authored-by: Erik Johnston <erikj@jki.re>
  • Loading branch information
3 people authored Feb 18, 2025
1 parent 12dc6b1 commit 2d4f289
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/18144.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `get_current_time_msec()` method to the [module API](https://matrix-org.github.io/synapse/latest/modules/writing_a_module.html) for sound time comparisons with Synapse.
4 changes: 4 additions & 0 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,10 @@ async def set_displayname(
deactivation=deactivation,
)

def get_current_time_msec(self) -> int:
"""Returns the current server time in milliseconds."""
return self._clock.time_msec()


class PublicRoomListManager:
"""Contains methods for adding to, removing from and querying whether a room
Expand Down

0 comments on commit 2d4f289

Please sign in to comment.