Эх сурвалжийг харах

matrix, portal: fix imports and use time.time() instead of datetime.now().timestamp

Sumner Evans 3 жил өмнө
parent
commit
9721ce0235

+ 0 - 1
mautrix_signal/matrix.py

@@ -14,7 +14,6 @@
 # You should have received a copy of the GNU Affero General Public License
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 from typing import List, Union, TYPE_CHECKING
 from typing import List, Union, TYPE_CHECKING
-from datetime import datetime
 
 
 from mautrix.bridge import BaseMatrixHandler
 from mautrix.bridge import BaseMatrixHandler
 from mautrix.types import (Event, ReactionEvent, StateEvent, RoomID, EventID, UserID, TypingEvent,
 from mautrix.types import (Event, ReactionEvent, StateEvent, RoomID, EventID, UserID, TypingEvent,

+ 1 - 2
mautrix_signal/portal.py

@@ -19,7 +19,6 @@ from html import escape as escape_html
 from collections import deque
 from collections import deque
 from uuid import UUID, uuid4
 from uuid import UUID, uuid4
 from string import Template
 from string import Template
-from datetime import datetime
 import mimetypes
 import mimetypes
 import pathlib
 import pathlib
 import hashlib
 import hashlib
@@ -555,7 +554,7 @@ class Portal(DBPortal, BasePortal):
         # resume the countdown. This is fairly likely to occur if the disappearance timeout is
         # resume the countdown. This is fairly likely to occur if the disappearance timeout is
         # weeks.
         # weeks.
         # If there is not an expiration_ts, then set one.
         # If there is not an expiration_ts, then set one.
-        now = datetime.now().timestamp()
+        now = time.time()
         if disappearing_message.expiration_ts is not None:
         if disappearing_message.expiration_ts is not None:
             wait = (disappearing_message.expiration_ts / 1000) - now
             wait = (disappearing_message.expiration_ts / 1000) - now
         else:
         else: