C++Builder Daylight Savings Time (DST) RTL Patches

Abstract: C++Builder Daylight Savings Time (DST) RTL Patches

Hotfix 11 adds new daylight saving rules in effect for 2007.

There are now three periods supported:

1970-1986 DST starts last Sunday in April and ends last Sunday in October
1987-2006 DST starts first Sunday in April and ends last Sunday in October
2007- DST starts second Sunday in March and ends first Sunday in November

There are additionally two behavior changes:

The time from 2:00-2:59 on a DST transition (which doesn't exist) was being
treated as requests for an hour earlier. This was compatible with Microsoft VC
but differs from Linux and Mac and what most people expect. We now behave like
the wall clock and jump forward into DST. This behavior can currently be
overridden by setting the variable _PREFER_START_DAYLIGHT_TIME declared in
time.h to zero.

Another change is the selection of time during the overlapping hour at the end
of DST (1:00-1:59). Our previous behavior was to select the first time (in
DST). We now select the standard time version which is compatible with
Microsoft VC, Linux, and Mac. This behavior can currently be overridden by
setting the variable _PREFER_END_STANDARD_TIME declared in time.h to zero.

Obtaining the Patch:

For BDS 2006 users:

1. Unzip the hotfix zip file into a temporary directory

2. Copy the two dll files from the hotfix bin directory to your
c:\windows\system32 directory, replacing the old versions of the files.

NOTE: When deploying applications you should copy the neccessary DLLs into
your application directory to ensure that you are using the versions you built
against.

3. Copy time.h from the hotfix include directory to your BDS include directory
(by default C:\Program Files\Borland\BDS\4.0\include), replacing the old
time.h.

3. Copy the six lib files from the hotfix lib directory to your BDS lib
directory (by default C:\Program Files\Borland\BDS\4.0\lib), replacing the old
versions of the files.

4. Copy timefunc.c from the hotfix source\time directory to the source\time
subdirectory of the RTL source tree (by default c:\Program Files\Borland\BDS\4.0\source\cpprtl\Source\time)
replacing the old version of timefunc.c.

For previous versions:

Put timefunc.c into the source\time subdirectory of the RTL source tree and time.h into the include directory. Follow the instructions given in the README in the source\rtl directory of your existing product for rebuilding the libraries.

If you would like to override the behaviors described above then you can add the following lines (after mktime() is a good place) to time.h in the standard include directory.

extern unsigned char _RTLENTRY _EXPDATA _PREFER_END_STANDARD_TIME;
extern unsigned char _RTLENTRY _EXPDATA _PREFER_START_DAYLIGHT_TIME;
#pragma obsolete _PREFER_END_STANDARD_TIME
#pragma obsolete _PREFER_START_DAYLIGHT_TIME