Первоапрельская шутка от борланда

From
Sergey Andyk (2:5005/58.43)
To
All
Date
2002-04-02T16:24:04Z
Area
SU.WINDOWS.NT.PROG
Good day (morning,evening,night) All!

2 дня убил, епрст. Borland C++ Builder 5 Enterprice с сервиспаком.

Вот такую тестовую херульку компиляем в BCB и в VC:

#include <windows.h>
#include <stdio.h>
#include <time.h>
void main()
{
_tzset();
time_t zad=1017650772;
printf("%s",ctime(&zad));
}

Результаты:

=== Cut ===
C:\Projects\MSDEV\ctimetest\Release>ctimetest.exe
Mon Apr 01 16:46:12 2002

C:\...Files\Borland\CBuilder5\Projects\ctimetest>Project1.exe
Mon Apr 01 15:46:12 2002
=== Cut ===

А причина такова (поймаю гадов - поубиваю или покалечу):

Файл timefunc.c из исходников BCB RTL (ф-ия _isDST  -  determines whether daylight savings is in effect)

=== Cut ===
    /* Weed out months other than April or October.
     */
    if (month < April || month > October)
        return (0);
    if (month > April && month < October)
        return (1);

    /* Month is either April or October.  Up through 1986, the starting
     * day for DST is the last Sunday in April; after that it is
     * the first Sunday in April.  The last day of DST is the last Sunday
     * in October.
     */
=== Cut ===

Пришлось из VC RTL портировать time,ctime,asctime,localtime,gmtime. В микрософте видимо таких халявщиков нет, там всё берется GetTimeZoneInformation и работает как надо.


        Bye Bye!
      Злобный SERG

--- GEcho 1.20/Pro
 * Origin: asvzzz@narod.ru, http://asvzzz.narod.ru  (2:5005/58.43)