wxDateTime

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
trublemaker
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Mar 09, 2005 3:46 am

wxDateTime

Post by trublemaker » Mon May 09, 2005 9:26 am

hi, I use wxDateTime to do somthing.
I find that when after set the value(year,month,day...) the millisecond is always be set to zero.
I trace to the datetime.cpp and find those method finally call Set(const Tm& tm) like

inline wxDateTime& wxDateTime::Set(const Tm& tm)
{
wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") );

return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec);
}

it does not set the Millisecond ,default is zero, does it have some reason? or a BUG?

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Mon May 09, 2005 11:21 am

The structure Tm doesn't support milliseconds. Which methods are you using that end up with a call to Set(const Tm& tm)? There are 6 Set functions and without looking at the implementation, I'd assume 5 of them all call the version that accepts everything from days to milliseconds (like the version you posted does). Perhaps the methods you are calling aren't millisecond friendly.

trublemaker
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Mar 09, 2005 3:46 am

resolved

Post by trublemaker » Tue May 10, 2005 8:45 am

TEST Code
wxDateTime t;
long x ;

t.SetToCurrent();
t.SetMillisecond(107);
x = t.GetMillisecond();

t.SetSecond(10);
x = t.GetMillisecond();


the Milisecond was set to zero after call SetSecond(SetDay....)

inline wxDateTime& wxDateTime::Set(const Tm& tm)
{
wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") );

return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec,
tm.msec
);
}
after add tm.msec the code can work normally

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Tue May 10, 2005 9:49 am

Ah, right you are. I was looking for "milli" when I looked over the Tm structure. I'm sure the developers would appreciate if you made a patch for this. It's kind of a weird oversight though.

trublemaker
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Mar 09, 2005 3:46 am

Post by trublemaker » Wed May 11, 2005 4:58 am

Ai,I have nothing to say.
The author doesn't think the code has bug and insist that all problem have been fix at the 2.6 branch.And close the patch my commit immediately.
But the fact is my code can not work!!!! :cry:
It's a new day,it's a new start...

leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio » Thu May 12, 2005 9:39 am

Could you give the sf.net link to the patch tracker item?
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Post by ABX » Thu May 12, 2005 9:49 am

leio wrote:Could you give the sf.net link to the patch tracker item?
http://sourceforge.net/tracker/index.ph ... tid=309863

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

Post Reply