Recognize wxDefaultDateTime in gdb wxDateTime pretty-printer.

Trying to print an uninitialized/invalid wxDateTime in gdb resulted in an
error (Python exception from datetime module), recognize it specially now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-04-28 22:24:57 +00:00
parent 586c455167
commit d4bc7a1601

View File

@ -36,6 +36,8 @@ class wxDateTimePrinter:
# expressions directly so we need to convert it to long long first and
# then cast to int explicitly to be able to use it as a timestamp.
msec = self.val['m_time'].cast(gdb.lookup_type('long long'))
if msec == 0x8000000000000000:
return 'NONE'
sec = int(msec / 1000)
return datetime.datetime.fromtimestamp(sec).isoformat(' ')