To: John Mansfield who wrote (905 ) 1/16/1998 4:33:00 PM From: Tom C Read Replies (1) | Respond to of 9818
John: Re: tremble in fear for Unix, Linux, C and C++ I share your observation that little is found regarding C and C++ remediation. I am not sure why that is. It is impossible to prove the absence of a bug in a program, it is only possible to prove the existence of a flaw. This is usually done by testing. So until someone tests an application or the year 2000 comes and goes, who can say that a particular program do not have a Y2K flaw. That being said, can you please explain what Cory is referring to when he states "Ponder the meaning of the comment for tm_year..". Can someone post the contents of time.h (or the relevant structure)for a Unix system. Without this it is not possible to make sense of the information you posted. I program windows, the time.h shipping with MSVC++ 5.0 has a tm structure as follows: struct tm { int tm_sec; /* seconds after the minute - [0,59] */ int tm_min; /* minutes after the hour - [0,59] */ int tm_hour; /* hours since midnight - [0,23] */ int tm_mday; /* day of the month - [1,31] */ int tm_mon; /* months since January - [0,11] */ int tm_year; /* years since 1900 */ int tm_wday; /* days since Sunday - [0,6] */ int tm_yday; /* days since January 1 - [0,365] */ int tm_isdst; /* daylight savings time flag */ }; Is he referring to the comment "years since 1900", or is there a different comment for Unix systems? If he is talking about the "years since 1990" comment, well, I've pondered it and I am not trembling in fear because of it. I even wrote a little program that adds 100 to tm.tm_year after it contains the current date , as follows: #include <time.h> #include <stdio.h> struct tm *newtime; time_t aclock; void main( void ) { time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ /* tm form */ newtime->tm_year += 100; /* Print time as a string */ printf( "The date and time + 100 yrs are: %s", asctime( newtime ) ); } The output of this program is as follows: The data and time + 100 yrs are: Fri Jan 16 15:51:15 2098 Is Cory trying to say that representing the year as an offset from 1900 is somehow a bad thing? Playing around a little further, I revised the program to add 62899200 seconds (approximately 2 years of seconds) to the current time: #include <time.h> #include <stdio.h> struct tm *newtime; time_t aclock; void main( void ) { time( &aclock ); /* Get time in seconds */ aclock += 62899200; newtime = localtime( &aclock ); /* Convert time to struct */ /* tm form */ /* Print local time as a string */ printf( "The current date and time are: %s", asctime( newtime ) ); } The output from this is : The current date and time are Fri Jan 14 16:19:03 2000 My conclusion is that I need a little more information before I start trembling in fear over this particular issue. I guess I need to see the comment on a Unix system. Or run these tests on a Unix system. Regards Tom ps: Do not interpret this to mean that I do not believe there are many Y2K problems in applications written in C or C++. I just don't see the problem based on the information provided.