Microsoft Y2K  
Microsoft
 This static CD-based web site is representative of the www.microsoft.com/y2k site as of October 15, 1999.

Microsoft Year 2000 Readiness Disclosure & Resource Center
Visual C++ 4.2  (English) - 32-Bit Win

Product Summary
Product: Visual C++
Version: 4.2
Category: Compliant#
Operating System: 32-Bit Win
Language: English Release Date: 01 Aug 1996
Operational Range: 01 Jan 1980 - 18 Jan 2038
Can applications be built with this tool that adhere to the Microsoft Year 2000 Compliance Statement? Yes
Prerequisites: None
Product Dependencies: Windows NT 3.51, Windows NT 4.0, Windows 95, Internet Explorer 3.02, Acme Setup, ODBC driver, SQL Server, Microsoft Visual SourceSafe 5.0 (see the Visual Source Safe 5.0 compliance document for more details).
Clock Dependencies: System Clock
Last Updated: 10 Jun 1999
Product Details

 

This report applies to:

Enterprise and Professional Editions.

 

Can applications be built with this tool that adhere to the Microsoft Year 2000 Compliance Statement?

Yes.

Note: This requires that any available and appropriate software updates or service packs have been applied.


How the product runtime handles dates:

Visual C++ 4.2 uses the following base data types for dates.

Data type

Range

time_t

1/1/1970 through 1/18/2038

DATE VARIANT

1/1/100 through 12/31/9999

struct FILETIME

The number of 100 nanosecond intervals since 1601 and until the year 58,457,005 A.D. (a 64-bit value)

struct SYSTEMTIME

The year (since 0 A.D.) in an unsigned 16-bit value

DOS DateTime

1/1/1980 through 12/31/2108

SQL_DATE & SQL_TIMESTAMP (ODBC)

1/1/1970 through 12/31/9999

 

Known Issues:
There is a known cosmetic issue: if the system clock is set to 2000 and you create a default Microsoft Foundation Classes (MFC) AppWizard application, the generated copyright reads "1900". This will not impact the functionality of the generated program but should be corrected using the resource editor, as it may cause confusion as to when the document was actually written.

The Microsoft C Runtime Library (MSVCRT) prior to version 4.2 6.00.8397.0 exhibited a daylight savings time bug - Applications that utilize this runtime library may behave as if current time is one hour earlier than the correct time shown on the Windows clock. The problem will continue for one week from April 1 through April 8, 2001, after which these applications will shift to daylight savings time and again be in sync with the operating system. This is not a year 2000 issue but rather a daylight savings time issue. It could occur in the years 1973, 1979, 1984, 1990, 2001, 2007, 2012, 2018, 2029, and 2035. The common thing about these years is that April 1 falls on a Sunday. A fix for this issue is available in Visual Studio 6.0 Service Pack 3 and Windows Update.

Two-digit shortcut handling:

The product provides 2-digit shortcuts for display only.

The Microsoft C Run Time provides two ANSI-C data structures to track time. These are

  1. struct tm
  2. time_t

ANSI types: struct tm and time_t

The ANSI C standard has established these types, their meaning and to some extent, the underlying type of each. In Visual C++, the type of time_t is long and it represents seconds since January 1, 1970 when used with the ANSI C functions that utilize variables of this type. The type struct tm is used to track the components of a date. The struct tm uses internal variables to store years as the number of years since 1900, the month of the year, day of the week, day of the month, day of the year, hour of the day, minute of the hour, and seconds of the minute are accounted for in this structure as well as if Daylight Savings Time is in effect. These members are of type int. These types are what ANSI functions use to manipulate, input, and output times. The Visual C++ documentation has more information on these types.

Avoiding issues with ANSI time functions

An application can appear to have a year 2000 issue because of how ANSI functions are permitted to behave. You can create year 2000 compliant applications and avoid confusing output from your programs if you follow some simple guidelines when using ANSI functions, primarily the strftime and wcsftime functions.

  1. Present 4-digit years when displaying dates to users of your application. When using the strftime and wcsftime functions, use %Y to display a 4-digit year instead %y (lowercase) which displays a 2-digit year. For example:

    #include <time.h>

    #include <stdio.h>

    const int BUFSIZE = 256;

    char buf[BUFSIZE];

    int main()

    {

    struct tm now;

    time_t tmp = time(0); // get current time

    now = *localtime(&tmp); // get components

    // 2-digit vs. 4-digit year

    char fmt[] = " %m/%d/%y \n %m/%d/%Y ";

    strftime( buf, BUFSIZ, fmt, &now );

    printf(buf);

    return 0;

    }

  2. Require users of your application to provide fully qualified dates (using 4-digit years) when accepting date input into your application.
  3. Avoid using the %x or %c format, or if used, use # to get the long date version when using strftime and wcsftime. The %x and %c formatting codes default to printing a 2-digit year. Change the initialization of fmt in the above program to " %x \n %#x " to see the difference.
  4. Keep your times in a time_t variable or a struct tm and manipulate them there. ANSI C mandates some other time functions to aid in this task. Here is a list and brief description of these functions. See your Visual C++ documentation for more details.
  • time û gets the current calendar time in a time_t
  • difftime û computes the difference between two time_tÆs
  • gmtime û converts a time_t to a struct tm, in terms of Coordinated Universal Time (UTC)
  • localtime û converts a time_t to a struct tm, in terms of local time
  • asctime, _wasctime û returns a string corresponding to the passed struct tm*. The string is of the form "DDD MMM dd HH:MM:SS YYYY\n\0" and is always 26 characters.
  • ctime, _wctimeû given a time_t, returns the local time in the form of a string. Exactly the same as asctime( localtime( time_t_val ))
  • mktime û returns a locally adjusted time_t given a struct tm*, which is updated so values fall into appropriate ranges. For example

#include <time.h>

#include <stdio.h>

const int BUFSIZE = 1024;

char buf[BUFSIZE];

int main()

{

struct tm now;

time_t tmp = time(0); // current time

now = *localtime(&tmp);

size_t len = strftime(buf, BUFSIZE, "%#c\n", &now);

now.tm_hour += 48; //jump ahead two days

// should get a bogus hour value

len += strftime(buf+len, BUFSIZE-len, "%#c\n", &now);

mktime(&now); // mktime will correct

strftime(buf+len, BUFSIZE-len, "%#c\n", &now);

printf(buf);

return 0;

}

  1. Although not an ANSI function, the _strdate and _wstrdate functions generates a 9-character string to a buffer that it receives a pointer to as a parameter. The output has the form "MM/DD/YY". Use the strftime or wcsftime function instead.

 

Recommended practices to develop year 2000 compliant applications:

Please see the "Visual C++ and the Year 2000" best practices article located at http://msdn.microsoft.com/visualc.

Non-Microsoft components (these are not covered by this document):
Oracle ODBC driver
"TimeLock" timebomb component (used in demo versions only)
InstallShield

Product includes non-Visual C++ components with which the user can build applications (these are not covered by this document):
ODBC, OLE DB (Data Access Group)

OLEAUT32.DLL
Month Calendar Control, Access Calendar Control (Office Group)
MS Month View Control, DBGrid, DBCombo, DBList, DataGrid, DataCombo, DataList, FlexGrid, Hierarchical FlexGrid (Visual Basic Group)
Database engines (DAO, Access Jet)
Component Gallery: status bar

Common development errors dealing with year 2000 date issues:

The most likely area for concern arises if users write their own date handling routines. Please see the "Visual C++ and the Year 2000" best practices article located at http://msdn.microsoft.com/visualc.

Testing guidelines and recommendations:

Please see the "Visual C++ and the Year 2000" best practices article located at http://msdn.microsoft.com/visualc.

 

 

Return to Search Screen

Legend of Symbols:
* The product is compliant with recommended customer action. This indicates a prerequisite action is recommended which may include loading a software update or reading a document.
# The product is compliant with acceptable deviations from Microsoft's standard of compliance. An acceptable deviation does not affect the core functionality, data integrity, stability, or reliability of the product.
+ The product is compliant with pending Year 2000 software updates. Future maintenance actions will be recommended shortly. See Product Guide for further details.
Note: Compliance ratings given for each product assume that all recommended actions have been taken.

If after reviewing this information you have additional questions related to this product, click here.

 

YEAR 2000 READINESS DISCLOSURE

ALL COMMUNICATIONS OR CONVEYANCES OF INFORMATION TO YOU CONCERNING MICROSOFT AND THE YEAR 2000, INCLUDING BUT NOT LIMITED TO THIS DOCUMENT OR ANY OTHER PAST, PRESENT OR FUTURE INFORMATION REGARDING YEAR 2000 TESTING, ASSESSMENTS, READINESS, TIME TABLES, OBJECTIVES, OR OTHER (COLLECTIVELY THE "MICROSOFT YEAR 2000 STATEMENT"), ARE PROVIDED AS A "YEAR 2000 READINESS DISCLOSURE" (AS DEFINED BY THE YEAR 2000 INFORMATION AND READINESS DISCLOSURE ACT) AND CAN BE FOUND AT MICROSOFT'S YEAR 2000 WEBSITE LOCATED AT http://www.microsoft.com/year2000/ (the "Y2K WEBSITE"). EACH MICROSOFT YEAR 2000 STATEMENT IS PROVIDED PURSUANT TO THE TERMS HEREOF, THE TERMS OF THE Y2K WEBSITE, AND THE YEAR 2000 INFORMATION AND READINESS DISCLOSURE ACT FOR THE SOLE PURPOSE OF ASSISTING THE PLANNING FOR THE TRANSITION TO THE YEAR 2000. EACH MICROSOFT YEAR 2000 STATEMENT CONTAINS INFORMATION CURRENTLY AVAILABLE AND IS UPDATED REGULARLY AND SUBJECT TO CHANGE. MICROSOFT THEREFORE RECOMMENDS THAT YOU CHECK THE Y2K WEBSITE REGULARLY FOR ANY CHANGES TO ANY MICROSOFT YEAR 2000 STATEMENT. EACH MICROSOFT YEAR 2000 STATEMENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. CONSEQUENTLY, MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. MOREOVER, MICROSOFT DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF ANY MICROSOFT YEAR 2000 STATEMENT IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY, OR OTHERWISE. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY MICROSOFT OR ITS AUTHORIZED REPRESENTATIVES SHALL CREATE A WARRANTY OR IN ANY WAY DECREASE THE SCOPE OF THIS WARRANTY DISCLAIMER. IN NO EVENT SHALL MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER REGARDING ANY MICROSOFT YEAR 2000 STATEMENT INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS, PUNITIVE OR SPECIAL DAMAGES, EVEN IF MICROSOFT OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE FOREGOING LIMITATION MAY NOT APPLY TO YOU. THE INFORMATION CONTAINED IN EACH MICROSOFT YEAR 2000 STATEMENT IS FOUND AT THE Y2K WEBSITE AND IS INTENDED TO BE READ IN CONJUNCTION WITH OTHER INFORMATION LOCATED AT THE Y2K WEBSITE, INCLUDING BUT NOT LIMITED TO MICROSOFT'S YEAR 2000 COMPLIANCE STATEMENT, THE DESCRIPTION OF THE CATEGORIES OF COMPLIANCE INTO WHICH MICROSOFT HAS CLASSIFIED ITS PRODUCTS IN ITS YEAR 2000 PRODUCT GUIDE, AND THE MICROSOFT YEAR 2000 TEST CRITERIA.

ANY MICROSOFT YEAR 2000 STATEMENTS MADE TO YOU IN THE COURSE OF PROVIDING YEAR 2000 RELATED UPDATES, YEAR 2000 DIAGNOSTIC TOOLS, OR REMEDIATION SERVICES (IF ANY) ARE SUBJECT TO THE YEAR 2000 INFORMATION AND READINESS DISCLOSURE ACT (112 STAT. 2386). IN CASE OF A DISPUTE, THIS ACT MAY REDUCE YOUR LEGAL RIGHTS REGARDING THE USE OF ANY SUCH STATEMENTS, UNLESS OTHERWISE SPECIFIED BY YOUR CONTRACT OR TARIFF.


 

Monday, September 20, 1999
1999 Microsoft Corporation. All rights reserved. Terms of use.

This site is being designated as a Year 2000 Readiness Disclosure and the information contained herein is provided pursuant to the terms hereof and the Year 2000 Information and Readiness Disclosure Act.