This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

`tar' does not handle dates greater than 1999



The `tar' utility in gnu-win32 Beta 18 under NT 4.0 does not recognize   
years greater than 1999. For example, the following command works OK:

         tar cf junk "--newer=1/1/1998 12:00" t*.exe

but the following fails with the error message:

         tar cf junk "--newer=1/1/2000 12:00" t*.exe

         tar: Invalid date format `1/1/2000 12:00'

Since tar uses the getdate function, specified in getdate.c and   
getdate.y, any other utility which references getdate for parsing a date   
string will also fail if the string contains a date of 2000 or greater.   
 Additionally, the two-digit year less than 70 will result in the   
assumption of 19xx instead of 20xx.

The following sequence in the `Convert' function in getdate.y (around   
line 634) or in getdate.c:

  Year = -Year;
  if (Year < 100)
    Year += 1900;
  DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
    ? 29 : 28;
  if (Year < EPOCH || Year > 1999
      || Month < 1 || Month > 12
   

may be replaced with the following to rectify the problem:

  Year = -Year;
  if (Year < EPOCH)                          /* new */
    Year += 2000;                            /* new */
  if (Year < 256)                            /* changed */
    Year += 1900;
  DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
    ? 29 : 28;
  if (Year < EPOCH || Year > 2063            /* changed */
      || Month < 1 || Month > 12
   

Although this violates the intent of assuming the current century when a   
two digit year is specified, the preferrable assumption is that a two   
digit year less than the epoch (1970) represents a year above 1999 (that   
is, simply add 2000 to the value).

 ------------------
Dale Harris             Dale.Harris@symbios.com
Symbios Inc.            Phone: +1-316-636-8025
Wichita, Ks 67212       Fax: +1-316-636-8886



-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]