diff --git a/qutebrowser/app.py b/qutebrowser/app.py index da0a4ef6d..927d43b29 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -29,6 +29,7 @@ import time import shutil import tempfile import atexit +import datetime from PyQt5.QtWidgets import QApplication from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow @@ -712,6 +713,8 @@ class Application(QApplication): objreg.register('args', args) objreg.register('app', self) + self.launch_time = datetime.datetime.now() + def __repr__(self): return utils.get_repr(self) diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py index 64cccde83..05cca5b85 100644 --- a/qutebrowser/misc/crashdialog.py +++ b/qutebrowser/misc/crashdialog.py @@ -29,7 +29,7 @@ import pkg_resources from PyQt5.QtCore import pyqtSlot, Qt, QSize, qVersion from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton, QVBoxLayout, QHBoxLayout, QCheckBox, - QDialogButtonBox, QMessageBox) + QDialogButtonBox, QMessageBox, QApplication) import qutebrowser from qutebrowser.utils import version, log, utils, objreg, qtutils @@ -219,6 +219,10 @@ class _CrashDialog(QDialog): cmdhist: A list with the command history (as strings) exc: An exception tuple (type, value, traceback) """ + try: + self._crash_info.append(('Launch time', QApplication.instance().launch_time.strftime("%d-%m-%Y %H:%M:%S"))) + except Exception: + self._crash_info.append(("Launch time", traceback.format_exc())) try: self._crash_info.append(("Version info", version.version())) except Exception: