Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

COleDateTime::GetCurrentTime

155 views
Skip to first unread message

Royce S. Shelley

unread,
Jan 28, 1999, 3:00:00 AM1/28/99
to
Help, I am confused.

The documentation for the COleDateTime class states that it handles dates
from January 1, 100 to December 31, 9999.

This seems to work fine as long as I stay with dates less than 2000. However
whenever I set my clock to a date in the year 2000 the GetGetCurrent time
function begins returning negative values which according to the documentation
are reserved for dates less than December 30, 1899. (This occurs in Visual
C++ 4.0) In visual C++ 6.0 the year 2000 returns proper dates but when the
clock moves to 2039 or greater the whole thing dies with

Debug Assertion Failed
olevar.cpp
line 1960

My code is as follows

COleDateTime Current;
Current = COleDateTime::GetCurrentTime();

Is anyone aware of a way to get valid dates and times with a resolutions of a
minimum of seconds for years 2000 and beyond (preferable forever, but at least
accurate to 2100).

Thanks in advance.

Royce
ro...@sewarner.com
801-277-9444

David Wilkinson

unread,
Jan 28, 1999, 3:00:00 AM1/28/99
to
Royce:

I don't know about the 2000 problem you mention in VC4.0. Is that really true?

But I believe that you must not use COleDateTime::GetCurrentTime() if you want
your code to work for dates beyond 2039. It absolutely amazes me that MS has
allowed this problem to persist into VC 6.0. If you use some other means to feed
the current time to COleDateTime then I believe there are no problems.

HTH,

David Wilkinson

==================

PJ Naughter

unread,
Jan 29, 1999, 3:00:00 AM1/29/99
to
On Thu, 28 Jan 1999 16:59:47 -0500, David Wilkinson
<dave...@worldnet.att.net> wrote:

>Royce:
>
>I don't know about the 2000 problem you mention in VC4.0. Is that really true?
>
>But I believe that you must not use COleDateTime::GetCurrentTime() if you want
>your code to work for dates beyond 2039. It absolutely amazes me that MS has
>allowed this problem to persist into VC 6.0. If you use some other means to feed
>the current time to COleDateTime then I believe there are no problems.
>
>HTH,
>

If you are interested in a replacement class for both CTime and
COleDateTime, they have a look at DTime. You can download an
evaluation copy from my web site at http://indigo.ie/~pjn.

I totally agree with you on the fact that MS seems to be dragging
their heels on fixing up all the problems which have cropped up on
their date classes in MFC.

Regards,
'''
@ @
+========================ooO-(_)-Ooo================================+
| PJ Naughter |
| |
| Software Developer Home Email: p...@indigo.ie |
| Softech Telecom Work Email: pj.na...@softech-telecom.com |
| Web: http://indigo.ie/~pjn |
| ICQ: 25413168 |
| |
+===================================================================+


0 new messages