classlib/time.cpp
TTime::TTime( const TDate & date, HourTy h, MinuteTy m, SecondTy s )
{
    if( date.IsValid() )
        {
        Sec =   SECONDS_IN_DAY  * (date-RefDate) +
                SECONDS_IN_HOUR * (h-1L) +    /* Note the adjustment by one hour */
                SECONDS_IN_MIN  * m + s;
        if( Sec )
            Sec += _timezone;           // Adjust to GMT.

        if( IsDST() )
            {
            Sec += SECONDS_IN_HOUR;
            if( IsDST() )
                Sec -= SECONDS_IN_HOUR;
            }
        else
            {
            Sec += SECONDS_IN_HOUR;
            if( IsDST() )
                Sec = 0;            // Invalid "phantom" time.
            }
        }
    else
        Sec = 0;    // Invalid date
}
//
// Construct a Time for the specified (local) Date, hour, minute, and second.
// Note: this algorithm will fail if DST correction is something other
// than an hour.
// It is complicated by the DST boundary problem:
// 1) Times in the phantom zone between 2AM and 3AM when DST is invoked are invalid.
// 2) Times in the hour after 1AM when DST ends, are redundant.
// Checking for these situations necessitates a lot of jumping back
// and forth by an hour to check for the boundary.
//
Construct a Time for the specified (local) Date, hour, minute, and second.
Note: this algorithm will fail if DST correction is something other
than an hour.
It is complicated by the DST boundary problem:
1) Times in the phantom zone between 2AM and 3AM when DST is invoked are invalid.
2) Times in the hour after 1AM when DST ends, are redundant.
Checking for these situations necessitates a lot of jumping back
and forth by an hour to check for the boundary.
Construct a Time for the specified ( local ) Date hour minute and second . Note : this algorithm will fail if DST correction is something other than an hour . It is complicated by the DST boundary problem : 1 ) Times in the phantom zone between 2AM and 3AM when DST is invoked are invalid . 2 ) Times in the hour after 1AM when DST ends are redundant . Checking for these situations necessitates a lot of jumping back and forth by an hour to check for the boundary .
TTime::TTime( const TDate & date, HourTy h, MinuteTy m, SecondTy s )
{
    if( date.IsValid() )
        {
        Sec =   SECONDS_IN_DAY  * (date-RefDate) +
                SECONDS_IN_HOUR * (h-1L) +    
                SECONDS_IN_MIN  * m + s;
        if( Sec )
            Sec += _timezone;           
        if( IsDST() )
            {
            Sec += SECONDS_IN_HOUR;
            if( IsDST() )
                Sec -= SECONDS_IN_HOUR;
            }
        else
            {
            Sec += SECONDS_IN_HOUR;
            if( IsDST() )
                Sec = 0;            
            }
        }
    else
        Sec = 0;    
}
TTime :: TTime ( const TDate & date , HourTy h , MinuteTy m , SecondTy s ) { if ( date . IsValid ( ) ) { Sec = SECONDS_IN_DAY * ( date - RefDate ) + SECONDS_IN_HOUR * ( h - 1L ) + SECONDS_IN_MIN * m + s ; if ( Sec ) Sec += _timezone ; if ( IsDST ( ) ) { Sec += SECONDS_IN_HOUR ; if ( IsDST ( ) ) Sec -= SECONDS_IN_HOUR ; } else { Sec += SECONDS_IN_HOUR ; if ( IsDST ( ) ) Sec = 0 ; } } else Sec = 0 ; }
Construct a Time for the specified (local) Date, hour, minute, and second.
Construct a Time for the specified ( local ) Date hour minute and second .
/* Note the adjustment by one hour */ // Adjust to GMT. // Invalid "phantom" time. // Invalid date