Convert-Binary-C

 view release on metacpan or  search on metacpan

tests/include/pdclib/functions/_tzcode/_PDCLIB_localsub.c  view on Meta::CPAN


            if ( t < sp->ats[ 0 ] )
            {
                newy -= years;
            }
            else
            {
                newy += years;
            }

            if ( ! ( _PDCLIB_INT_MIN <= newy && newy <= _PDCLIB_INT_MAX ) )
            {
                return NULL;
            }

            result->tm_year = newy;
        }

        return result;
    }

    if ( sp->timecnt == 0 || t < sp->ats[ 0 ] )
    {
        i = sp->defaulttype;
    }
    else
    {
        int lo = 1;
        int hi = sp->timecnt;

        while ( lo < hi )
        {
            int mid = ( lo + hi ) >> 1;

            if ( t < sp->ats[ mid ] )
            {
                hi = mid;
            }
            else
            {
                lo = mid + 1;
            }
        }

        i = (int) sp->types[ lo - 1 ];
    }

    ttisp = &sp->ttis[ i ];

    /* To get (wrong) behavior that's compatible with System V Release 2.0
       you'd replace the statement below with
       t += ttisp->utoff;
       timesub( &t, 0L, sp, tmp );
    */
    result = _PDCLIB_timesub( &t, ttisp->utoff, sp, tmp );

    if ( result )
    {
        result->tm_isdst = ttisp->isdst;
#ifdef TM_ZONE
        result->TM_ZONE = (char *) &sp->chars[ ttisp->desigidx ];
#endif /* defined TM_ZONE */

        if ( setname )
        {
            _PDCLIB_update_tzname_etc( sp, ttisp );
        }
    }

    return result;
}

#endif

#ifdef TEST

#include "_PDCLIB_test.h"

int main( void )
{
#ifndef REGTEST
#endif

    return TEST_RESULTS;
}

#endif



( run in 0.549 second using v1.01-cache-2.11-cpan-5735350b133 )