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();
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.
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;
Re: Problem with COleDateTime Status
Quote:
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.
Re: Problem with COleDateTime Status
Quote:
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
Re: Problem with COleDateTime Status
Quote:
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? :confused:
Re: Problem with COleDateTime Status
Quote:
Originally Posted by
VictorN
Did you step in (F11) the COleDateTime::GetCurrentTime() source code? :confused:
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
Re: Problem with COleDateTime Status
Did you step in the ctor COleDateTime(::_time64(NULL))?