COleDateTime的数据不正确 [英] incorrect data of COleDateTime
本文介绍了COleDateTime的数据不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我遇到了很大的问题 COleDateTime
和 CTime
。
这就像地狱一样,我无法理解。我尝试初始化 COleDateTime
的值为 CTime
Hello!
I have the huge problem with COleDateTime
and CTime
.
That's like a hell, and I can't understand it. I try to initialize COleDateTime
by value of CTime
void CAnnouncementScheduleTab::ConvertToDateTime(COleDateTime & oleDate, CTime &time, CTime &date)
{
oleDate.SetStatus(COleDateTime::valid);
oleDate.SetDateTime(date.GetYear(), date.GetMonth(), date.GetDay(),
time.GetHour(), time.GetMinute(), time.GetSecond());
int a = date.GetYear();
int b = date.GetMonth();
int c = date.GetDay();
int d = time.GetHour() ;
int e = time.GetMinute();
int f = time.GetSecond();
int y = oleDate.GetYear();
int h = oleDate.GetMonth();
int m = oleDate.GetDay();
int o = oleDate.GetHour();
int l = oleDate.GetMinute();
int p = oleDate.GetSecond();
ASSERT(a == y && b == h
&& c == m && d == o &&
e == l && f == p);
oleDate.SetStatus(COleDateTime::valid);
}
如何看待时间和日期变量就行了!并且a - f是正常值,但是yp是-1。
为什么我得到它?
在此方法之前我做了默认构造函数,有时我得到了错误的值几分钟或多或少然后我预期。
谢谢
How can you see time and date variables is OK! and a - f is normal values, but y-p is -1.
Why Am I getting it?
Before this method I did default constructor and sometimes I got bad values like a couple minutes more or less then I expected.
Thank you
推荐答案
看起来oledate无效。
提示:它是你函数中的输入参数,所以在你调用函数之前做一个有效的oledate。
it looks like the oledate isnt valid.
Hint: it is a input parameter in your function, so make a valid oledate before you call your function.
那是内存,僵尸指针的问题
That's was a problem with memory, zombie pointer
这篇关于COleDateTime的数据不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文