|
-
December 29th, 2010, 07:09 AM
#1
Problem with COleDateTime Status
I am initializing a COleDateTime object with the current date like this, and its m_status is coming invalid. Can someone tell me the reason? This is the first time I've come across this kind of problem, while initializing COleDateTime with current time
Code:
COleDateTime dtInstalled = COleDateTime::GetCurrentTime();
-
December 29th, 2010, 07:55 AM
#2
Re: Problem with COleDateTime Status
I never saw such a situation.
Try to debug this code and see why the status is set to invalid.
Victor Nijegorodov
-
December 29th, 2010, 08:20 AM
#3
Re: Problem with COleDateTime Status
yes while debugging only I saw when I initialize it, with current date, its m_status value comes out to be invalid and somewhere in net i checked out that anyone using Direct X 9 SDK is encountering this problem, which is consiered to be a bug, but i am unable to find no solution so as a temporary alternative I am using this condition
Code:
if (dtNow.m_status != COleDateTime::valid )
return 0;
-
December 29th, 2010, 08:57 AM
#4
Re: Problem with COleDateTime Status
 Originally Posted by maverick786us
yes while debugging only I saw when I initialize it, with current date, its m_status value comes out to be invalid...
You are not understanding the suggestion to debug it. You need to step into the MFC source code and determine exactly where the call is failing. MFC uses various time-related functions (time(), GetLocalTime(), GetSystemTime(), GetTimeZoneInformation(), etc.) and somewhere in that source code you should be able to determine the point of failure and why it is happening.
-
December 30th, 2010, 06:40 AM
#5
Re: Problem with COleDateTime Status
 Originally Posted by 0xC0000005
You are not understanding the suggestion to debug it. You need to step into the MFC source code and determine exactly where the call is failing. MFC uses various time-related functions (time(), GetLocalTime(), GetSystemTime(), GetTimeZoneInformation(), etc.) and somewhere in that source code you should be able to determine the point of failure and why it is happening.
While debugging I noticed, right after initialization..
Code:
COleDateTime dtInstalled = COleDateTime::GetCurrentTime();
It shows the value of m_status
Code:
dtInstalled = {m_dt=40203.667685185188 m_status=invalid }
So this invalid value later in the code while making this kind of comparision
Code:
if(dtNow - dtInstalled > COleDateTimeSpan(120, 0, 0, 0))
return 0;
Breaks the code thus causing debug assertion failure
-
December 30th, 2010, 06:44 AM
#6
Re: Problem with COleDateTime Status
 Originally Posted by maverick786us
While debugging I noticed, right after initialization..
Code:
COleDateTime dtInstalled = COleDateTime::GetCurrentTime();
It shows the value of m_status
Code:
dtInstalled = {m_dt=40203.667685185188 m_status=invalid }
Did you step in (F11) the COleDateTime::GetCurrentTime() source code?
Victor Nijegorodov
-
December 30th, 2010, 07:05 AM
#7
Re: Problem with COleDateTime Status
 Originally Posted by VictorN
Did you step in (F11) the COleDateTime::GetCurrentTime() source code? 
Yes while going inside at initialization (F11)
Code:
ATLCOMTIME_INLINE COleDateTime WINAPI COleDateTime::GetCurrentTime() throw()
{
return COleDateTime(::_time64(NULL));
}
nothing happens, only after returning from this function it starts showing m_status invalid
-
December 30th, 2010, 07:18 AM
#8
Re: Problem with COleDateTime Status
Did you step in the ctor COleDateTime(::_time64(NULL))?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|