Skip to content

DateTime.FromTimeT() generates invalid dates #1910

Description

@StokesMIDE

Operating system: Windows 10 (build 10.0.18363)
wxPython version & source: 4.1.1 from PyPI
Python version & source: Stock 3.7.4 and stock 3.9.1

Description of the problem:
DateTime.FromTimeT() is failing in Python 3.7.4 and 3.9.1. The results are slightly different, although that may simply be the reporting; it looks like the same root problem.

In 3.7.4, the method executes, but generates bad values (equivalent Python datetime used to show expected behavior):

>>> import datetime, wx
>>> datetime.datetime.fromtimestamp(1611851055)
datetime.datetime(2021, 1, 28, 11, 24, 15)
>>> wx.DateTime.FromTimeT(1611851055)
<wx.DateTime: "Fri Dec 16 17:16:15 59183">

In 3.9.1, the same call to wx.DateTime.FromTimeT() produces a series of wxPython Debug Alert dialogs before the Python interpreter shuts down:
FromTimeT-1
FromTimeT-2
FromTimeT-3

In 3.7.4, the wx,DateTime.FromTimeT() results are the same whether a wx.App is running or not. In 3.9.1, the debug alerts only show up if a wx.App has not been instantiated; without it, the interpreter simply shuts down.

I can't verify it at the moment, but I believe DateTime.FromTimeT() was working in wxPython 4.0.7; I skipped 4.1.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions