Browse Source

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

Sumner Evans 3 năm trước cách đây
mục cha
commit
9721ce0235
2 tập tin đã thay đổi với 1 bổ sung3 xóa
  1. 0 1
      mautrix_signal/matrix.py
  2. 1 2
      mautrix_signal/portal.py

+ 0 - 1
mautrix_signal/matrix.py

@@ -14,7 +14,6 @@
 # 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/>.
 from typing import List, Union, TYPE_CHECKING
-from datetime import datetime
 
 from mautrix.bridge import BaseMatrixHandler
 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 uuid import UUID, uuid4
 from string import Template
-from datetime import datetime
 import mimetypes
 import pathlib
 import hashlib
@@ -555,7 +554,7 @@ class Portal(DBPortal, BasePortal):
         # resume the countdown. This is fairly likely to occur if the disappearance timeout is
         # weeks.
         # 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:
             wait = (disappearing_message.expiration_ts / 1000) - now
         else: