wxDateTime bug

Hello,

I'm trying to use wx.DataTime object for my app and I found one

strange behavior of it. It can’t be set to 2013.03.31 03:00 value.
Instead gives back 2013.03.31 02:00 value.
I tried different months, days, years but everey result was ok,
except this value.
Here code sample, which shows this issue.

import wx

date = wx.DateTime()
print date.SetToCurrent()
print date.SetYear(2013)
print date.SetMonth(2), date.GetMonthName(2)
print date.SetDay(31)
print '-'*20
for i in xrange(0,24):
    print date.SetHour(i)

Result:

09/12/13 17:59:33
09/12/13 17:59:33
03/12/13 17:59:33 March
03/31/13 17:59:33
···
03/31/13 00:59:33
03/31/13 01:59:33
**03/31/13 02:59:33** **03/31/13 02:59:33**
03/31/13 04:59:33
03/31/13 05:59:33
03/31/13 06:59:33
03/31/13 07:59:33
03/31/13 08:59:33
03/31/13 09:59:33
03/31/13 10:59:33
03/31/13 11:59:33
03/31/13 12:59:33
03/31/13 13:59:33
03/31/13 14:59:33
03/31/13 15:59:33
03/31/13 16:59:33
03/31/13 17:59:33
03/31/13 18:59:33
03/31/13 19:59:33
03/31/13 20:59:33
03/31/13 21:59:33
03/31/13 22:59:33
03/31/13 23:59:33

In result shows two of  **03/31/13 02:59:33**     values with no

value with 03:00 hour.

It looks like bug to me, but very very strange bug. Please, Can

someone confirm its a bug or help me to solve this issue (in nice
way, not with an extra “if” statement)

wx version: 2.8.12.1 (msw-ansi)

Best regards,

Evaldas

I found the answer. Its about my OS daylight saving time setting.
So now question is how can I make wx.DateTime object without DST impact?

Regards.

···

On 2013.09.12 18:12, evaldas wrote:

Hello,

I'm trying to use wx.DataTime object for my app and I found one strange behavior of it. It can't be set to 2013.03.31 03:00 value. Instead gives back 2013.03.31 02:00 value.
I tried different months, days, years but everey result was ok, except this value.
Here code sample, which shows this issue.

import wx

date = wx.DateTime()
print date.SetToCurrent()
print date.SetYear(2013)
print date.SetMonth(2), date.GetMonthName(2)
print date.SetDay(31)
print '-'*20
for i in xrange(0,24):
    print date.SetHour(i)

Result:

09/12/13 17:59:33
03/12/13 17:59:33 March
03/31/13 17:59:33
--------------------
03/31/13 00:59:33
03/31/13 01:59:33
*03/31/13 02:59:33**
**03/31/13 02:59:33*
03/31/13 04:59:33
03/31/13 05:59:33
03/31/13 06:59:33
03/31/13 07:59:33
03/31/13 08:59:33
03/31/13 09:59:33
03/31/13 10:59:33
03/31/13 11:59:33
03/31/13 12:59:33
03/31/13 13:59:33
03/31/13 14:59:33
03/31/13 15:59:33
03/31/13 16:59:33
03/31/13 17:59:33
03/31/13 18:59:33
03/31/13 19:59:33
03/31/13 20:59:33
03/31/13 21:59:33
03/31/13 22:59:33
03/31/13 23:59:33

In result shows two of *03/31/13 02:59:33 *values with no value with 03:00 hour.
It looks like bug to me, but very very strange bug. Please, Can someone confirm its a bug or help me to solve this issue (in nice way, not with an extra "if" statement)
wx version: 2.8.12.1 (msw-ansi)

Best regards,
Evaldas

What would you have it do? In my time zone, the time “2013/03/10
02:30:00” did not exist. It never happened. 01:59:59 was followed
immediately by 03:00:00. So, if I try to create a DateTime object
for 02:30, what should it do? What it DOES here is change the hour
to the last hour that WAS valid – 01:30:00.
You should be able to work around this by using GMT, but it’s not
clear to me that wx.DateTime handles that properly, either. My
suggestion is to use the Python datetime classes.

···

evaldas wrote:

-- Tim Roberts, Providenza & Boekelheide, Inc.
    I found the answer. Its about my OS

daylight saving time setting.

    So now question is how can I make wx.DateTime object without DST

impact?

timr@probo.com

I second Tim's suggestion. Welcome to the world of human timekeeping. I
have work to do in this area myself. Ugh.

···

On Thu, Sep 12, 2013 at 1:33 PM, Tim Roberts <timr@probo.com> wrote:

evaldas wrote:

I found the answer. Its about my OS daylight saving time setting.
So now question is how can I make wx.DateTime object without DST impact?

What would you have it do? In my time zone, the time "2013/03/10
02:30:00" did not exist. It never happened. 01:59:59 was followed
immediately by 03:00:00. So, if I try to create a DateTime object for
02:30, what should it do? What it DOES here is change the hour to the last
hour that WAS valid -- 01:30:00.

You should be able to work around this by using GMT, but it's not clear to
me that wx.DateTime handles that properly, either. My suggestion is to use
the Python datetime classes.

wx.DatePickerCtrl() object wants wx.Datetime(), it doesnt like python datetime. Sow I decided to create wx.Datetime() only with date ( time 00:00:00) and to choose hour with other control. It's good for my app, because sometimes i need more when 23 hour mark.:slight_smile:
Thanks for help.

···

On 2013.09.12 22:02, C M wrote:

On Thu, Sep 12, 2013 at 1:33 PM, Tim Roberts <timr@probo.com > <mailto:timr@probo.com>> wrote:

    evaldas wrote:

    I found the answer. Its about my OS daylight saving time setting.
    So now question is how can I make wx.DateTime object without DST
    impact?

    What would you have it do? In my time zone, the time "2013/03/10
    02:30:00" did not exist. It never happened. 01:59:59 was
    followed immediately by 03:00:00. So, if I try to create a
    DateTime object for 02:30, what should it do? What it DOES here
    is change the hour to the last hour that WAS valid -- 01:30:00.

    You should be able to work around this by using GMT, but it's not
    clear to me that wx.DateTime handles that properly, either. My
    suggestion is to use the Python datetime classes.

I second Tim's suggestion. Welcome to the world of human timekeeping. I have work to do in this area myself. Ugh.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.