diff --git a/changelog.d/18144.feature b/changelog.d/18144.feature new file mode 100644 index 00000000000..5279457df7f --- /dev/null +++ b/changelog.d/18144.feature @@ -0,0 +1 @@ +Add `get_current_time()` method to the [module API](https://matrix-org.github.io/synapse/latest/modules/writing_a_module.html) for sound time comparisons with Synapse. \ No newline at end of file diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 2a2f821427d..4f4f86e1a1f 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -1846,6 +1846,10 @@ async def set_displayname( deactivation=deactivation, ) + def get_current_time(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