Commit afb3483f authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

pamhyr: Fix windows timestamp.

Showing with 8 additions and 6 deletions
+8 -6
...@@ -230,16 +230,16 @@ class Study(SQLModel): ...@@ -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()
......
...@@ -18,6 +18,8 @@ ...@@ -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): ...@@ -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()
......
...@@ -237,7 +237,7 @@ def timestamp(dt: datetime): ...@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment