pamhyr: Fix windows timestamp.

adists_release
Pierre-Antoine Rouby 2024-07-16 08:58:12 +02:00
parent 73fd407aff
commit afb3483fe3
3 changed files with 8 additions and 6 deletions

View File

@ -230,16 +230,16 @@ class Study(SQLModel):
) )
self.execute( self.execute(
"INSERT INTO info VALUES ('date', " + "INSERT INTO info VALUES ('date', " +
f"'{self._date.timestamp()}')" f"'{timestamp(self._date)}')"
) )
self.execute( self.execute(
"INSERT INTO info VALUES ('creation_date', " + "INSERT INTO info VALUES ('creation_date', " +
f"'{self.creation_date.timestamp()}')" f"'{timestamp(self.creation_date)}')"
) )
self.execute( self.execute(
"INSERT INTO info VALUES ('last_save_date', " + "INSERT INTO info VALUES ('last_save_date', " +
f"'{self.last_save_date.timestamp()}')" f"'{timestamp(self.last_save_date)}')"
) )
self._create_submodel() self._create_submodel()

View File

@ -18,6 +18,8 @@
import logging import logging
from tools import timestamp
from PyQt5.QtCore import ( from PyQt5.QtCore import (
Qt, QRect, QTime, QDateTime, pyqtSlot, Qt, QRect, QTime, QDateTime, pyqtSlot,
) )
@ -55,8 +57,8 @@ class PamhyrExTimeDelegate(QItemDelegate):
if self._mode == "time": if self._mode == "time":
model.setData(index, int(time.total_seconds())) model.setData(index, int(time.total_seconds()))
else: else:
logger.debug(str(time.timestamp())) logger.debug(str(timestamp(time)))
model.setData(index, int(time.timestamp())) model.setData(index, int(timestamp(time)))
editor.close() editor.close()
editor.deleteLater() editor.deleteLater()

View File

@ -237,7 +237,7 @@ def timestamp(dt: datetime):
def date_iso_to_timestamp(date: str): def date_iso_to_timestamp(date: str):
if type(date) is str: if type(date) is str:
return datetime.fromisoformat(date).timestamp() return timestamp(datetime.fromisoformat(date))
else: else:
return datetime.isoformat(date) return datetime.isoformat(date)