mirror of https://gitlab.com/pamhyr/pamhyr2
pamhyr: Fix windows timestamp.
parent
73fd407aff
commit
afb3483fe3
|
|
@ -230,16 +230,16 @@ class Study(SQLModel):
|
|||
)
|
||||
self.execute(
|
||||
"INSERT INTO info VALUES ('date', " +
|
||||
f"'{self._date.timestamp()}')"
|
||||
f"'{timestamp(self._date)}')"
|
||||
)
|
||||
|
||||
self.execute(
|
||||
"INSERT INTO info VALUES ('creation_date', " +
|
||||
f"'{self.creation_date.timestamp()}')"
|
||||
f"'{timestamp(self.creation_date)}')"
|
||||
)
|
||||
self.execute(
|
||||
"INSERT INTO info VALUES ('last_save_date', " +
|
||||
f"'{self.last_save_date.timestamp()}')"
|
||||
f"'{timestamp(self.last_save_date)}')"
|
||||
)
|
||||
|
||||
self._create_submodel()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
import logging
|
||||
|
||||
from tools import timestamp
|
||||
|
||||
from PyQt5.QtCore import (
|
||||
Qt, QRect, QTime, QDateTime, pyqtSlot,
|
||||
)
|
||||
|
|
@ -55,8 +57,8 @@ class PamhyrExTimeDelegate(QItemDelegate):
|
|||
if self._mode == "time":
|
||||
model.setData(index, int(time.total_seconds()))
|
||||
else:
|
||||
logger.debug(str(time.timestamp()))
|
||||
model.setData(index, int(time.timestamp()))
|
||||
logger.debug(str(timestamp(time)))
|
||||
model.setData(index, int(timestamp(time)))
|
||||
editor.close()
|
||||
editor.deleteLater()
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ def timestamp(dt: datetime):
|
|||
|
||||
def date_iso_to_timestamp(date: str):
|
||||
if type(date) is str:
|
||||
return datetime.fromisoformat(date).timestamp()
|
||||
return timestamp(datetime.fromisoformat(date))
|
||||
else:
|
||||
return datetime.isoformat(date)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue