mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Fix windows timestamp.
This commit is contained in:
1 parent
73fd407aff
commit
afb3483fe3
3 files changed
+8
-6
No files matched your search
+3
-3
@@ -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()
|
||||
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user