Microsoft KB Archive/314048

= The DIR command displays wrong information for the date and time of a file =

Article ID: 314048

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Windows 2000 Service Pack 1
 * Microsoft Windows 2000 Service Pack 2
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Service Pack 1
 * Microsoft Windows 2000 Service Pack 2

-



This article was previously published under Q314048



SYMPTOMS
File times on Windows 2000 are stored as a FILETIME value. This is a 64-bit value that represents the number of 100-nanosecond intervals since January 1, 1601 (UTC). Windows 2000 also supports time-zone adjustments. Time-zone adjustments are accomplished by adding a time-zone offset to the UTC time to compute local time. Time-zone offsets range from -12 hours (Eniwetok, Kwajalein) to +13 hours (Nuku'alofa).

If the system time is set to January 1, 1601, 12:00am UTC, and a file is created, the various file times that are saved for the file are a FILETIME that is equal to zero (0). If a user then issues a dir command to list the file, the UTC time from the file is read, and the local time-zone adjustment is added. If the local time-zone adjustment is positive, a valid FILETIME is computed. However, if the computer is configured for a time zone with a negative time zone adjustment, an invalid FILETIME value is computed.

This invalid FILETIME value results in the dir command displaying an invalid and obviously incorrect date and time for the file. For example:

   D:\1601Date>dir Volume in drive D is Data Volume Serial Number is B00D-F582

Directory of D:\1601Date

12/15/2001 03:26 PM    . 12/15/2001 03:26 PM              .. 5252/00/23678 58848:92                15 test.txt 1 File(s)            15 bytes 2 Dir(s)  3,874,045,952 bytes free



CAUSE
This problem can occur because the dir command incorrectly assumes that the Win32 FileTimeToLocalFileTime API would always return a valid FILETIME. If the FILETIME is Jan 1, 1601 (a 64-bit value of zero), and the time-zone adjustment is negative, this assumption is incorrect.



RESOLUTION
To resolve this problem, obtain the latest service pack for Windows 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

260910 How to obtain the latest Windows 2000 service pack

The English version of this fix should have the following file attributes or later:

  Date         Time   Version        Size     File name -  02-Jan-2002  12:10  5.0.2195.4803  236,304  Cmd.exe



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section. This problem was first corrected in Windows 2000 Service Pack 3.



MORE INFORMATION
For more information about how to obtain a hotfix for Windows 2000 Datacenter Server, click the following article number to view the article in the Microsoft Knowledge Base:

265173 The Datacenter program and Windows 2000 Datacenter Server product

For more information about how to install multiple hotfixes with only one reboot, click the following article number to view the article in the Microsoft Knowledge Base:

296861 Use QChain.exe to install multiple hotfixes with one reboot

For more information about how to install Windows 2000 and Windows 2000 hotfixes at the same time, click the following article number to view the article in the Microsoft Knowledge Base:

249149 Installing Microsoft Windows 2000 and Windows 2000 hotfixes

Additional query words: kbBaseOS garbage

Keywords: kbbug kbfix kbwin2000presp3fix kbqfe kbwin2000sp3fix kbenv kbui kboswin2000fix kbhotfixserver KB314048

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.