void test_for_error( const char *const format, Args &&... args )
{
    CAPTURE( format );

    const std::string result = throwing_string_format( format, std::forward<Args>( args )... );
    CAPTURE( result );
}
示例#2
0
static OSStatus
DER_UTCTimeToCFDate(const SecAsn1Item * utcTime, CFAbsoluteTime *date)
{
    char *string = (char *)utcTime->Data;
    int year, month, mday, hour, minute, second, hourOff, minOff;

    /* Verify time is formatted properly and capture information */
    second = 0;
    hourOff = 0;
    minOff = 0;
    CAPTURE(year,string+0,loser);
    if (year < 50) {
        /* ASSUME that year # is in the 2000's, not the 1900's */
        year += 2000;
    } else {
        year += 1900;
    }
    CAPTURE(month,string+2,loser);
    if ((month == 0) || (month > 12)) goto loser;
    CAPTURE(mday,string+4,loser);
    if ((mday == 0) || (mday > 31)) goto loser;
    CAPTURE(hour,string+6,loser);
    if (hour > 23) goto loser;
    CAPTURE(minute,string+8,loser);
    if (minute > 59) goto loser;
    if (ISDIGIT(string[10])) {
        CAPTURE(second,string+10,loser);
        if (second > 59) goto loser;
        string += 2;
    }
    if (string[10] == '+') {
        CAPTURE(hourOff,string+11,loser);
        if (hourOff > 23) goto loser;
        CAPTURE(minOff,string+13,loser);
        if (minOff > 59) goto loser;
    } else if (string[10] == '-') {
        CAPTURE(hourOff,string+11,loser);
        if (hourOff > 23) goto loser;
        hourOff = -hourOff;
        CAPTURE(minOff,string+13,loser);
        if (minOff > 59) goto loser;
        minOff = -minOff;
    } else if (string[10] != 'Z') {
        goto loser;
    }

    if (hourOff == 0 && minOff == 0) {
        *date = CFAbsoluteTimeForGregorianZuluMoment(year, month, mday, hour, minute, second);
    } else {
        CFTimeZoneRef tz = CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorDefault, (hourOff * 60 + minOff) * 60);
        *date = CFAbsoluteTimeForGregorianMoment(tz, year, month, mday, hour, minute, second);
        CFReleaseSafe(tz);
    }

    return SECSuccess;

loser:
    return SECFailure;
}
void mingw_test( const char *const old_pattern, const char *const new_pattern, const T &value )
{
    CAPTURE( old_pattern );
    CAPTURE( new_pattern );
    std::string original_result = cata::string_formatter::raw_string_format( old_pattern, value );
    std::string new_result = throwing_string_format( new_pattern, value );
    CHECK( original_result == new_result );
}
void importet_test( const int serial, const char *const expected, const char *const format,
                    Args &&... args )
{
    CAPTURE( serial );
    CAPTURE( format );

    const std::string original_result = cata::string_formatter::raw_string_format( format,
                                        std::forward<Args>( args )... );
    const std::string new_result = throwing_string_format( format, std::forward<Args>( args )... );

    // The expected string *is* what the raw printf would return.
    CHECK( original_result == expected );
    CHECK( original_result == new_result );
}
示例#5
0
void IS_UNIFORM(
    const arma::Col<arma::uword>& actualData,
    const arma::uword expectedLowerBound,
    const arma::uword expectedUpperBound) {
  REQUIRE(arma::all(expectedLowerBound <= actualData));
  REQUIRE(arma::all(actualData <= expectedUpperBound));

  const arma::Col<arma::uword>& bins = arma::linspace<arma::Col<arma::uword>>(expectedLowerBound, expectedUpperBound, expectedUpperBound - expectedLowerBound + 1);
  CAPTURE(bins);

  const arma::Col<arma::uword>& histogram = arma::hist(actualData, bins);
  CAPTURE(histogram);

  REQUIRE((histogram.max() - histogram.min()) < static_cast<arma::uword>(0.05 * static_cast<double>(actualData.n_elem)));
}
void test_new_old_pattern( const char *const old_pattern, const char *const new_pattern,
                           Args &&...args )
{
    CAPTURE( old_pattern );
    CAPTURE( new_pattern );

    std::string original_result = cata::string_formatter::raw_string_format( old_pattern,
                                  std::forward<Args>( args )... );
    std::string old_result = throwing_string_format( old_pattern, std::forward<Args>( args )... );
    CHECK( original_result == old_result );

    if( new_pattern ) {
        std::string new_result = throwing_string_format( new_pattern, std::forward<Args>( args )... );
        CHECK( original_result == new_result );
    }
}
void test_for_expected( const std::string &expected, const char *const format, Args &&... args )
{
    CAPTURE( format );

    const std::string result = throwing_string_format( format, std::forward<Args>( args )... );
    CHECK( result == expected );
}
bool validate_ppf_results(rs2::frame origin_depth, rs2::frame result_depth, const ppf_test_config& reference_data, size_t frame_idx)
{
    std::vector<uint16_t> diff2orig;
    std::vector<uint16_t> diff2ref;

    // Basic sanity scenario with no filters applied.
    // validating domain transform in/out conversion. Requiring input=output
    bool domain_transform_only = (reference_data.downsample_scale == 1) &&
        (!reference_data.spatial_filter) && (!reference_data.temporal_filter);

    auto result_profile = result_depth.get_profile().as<rs2::video_stream_profile>();
    REQUIRE(result_profile);
    CAPTURE(result_profile.width());
    CAPTURE(result_profile.height());

    REQUIRE(result_profile.width() == reference_data.output_res_x);
    REQUIRE(result_profile.height() == reference_data.output_res_y);

    auto pixels = result_profile.width()*result_profile.height();
    diff2ref.resize(pixels);
    if (domain_transform_only)
        diff2orig.resize(pixels);

    // Pixel-by-pixel comparison of the resulted filtered depth vs data ercorded with external tool
    auto v1 = reinterpret_cast<const uint16_t*>(result_depth.get_data());
    auto v2 = reinterpret_cast<const uint16_t*>(reference_data._output_frames[frame_idx].data());

    for (auto i = 0; i < pixels; i++)
    {
        uint16_t diff = std::abs(*v1++ - *v2++);
        diff2ref[i] = diff;
    }

    // validating depth<->disparity domain transformation is lostless.
    if (domain_transform_only)
        REQUIRE(profile_diffs("./DomainTransform.txt",diff2orig, 0, 0, frame_idx));

    // Validate the filters
    // The differences between the reference code and librealsense implementation are byte-compared below
    return profile_diffs("./Filterstransform.txt", diff2ref, 0.f, 0, frame_idx);
}
// Verify that the named monster has the expected effective speed, not reduced
// due to wasted motion from shambling.
static void check_shamble_speed( const std::string monster_type, const tripoint &destination )
{
    // Scale the scaling factor based on the ratio of diagonal to cardinal steps.
    const float slope = get_normalized_angle( {0, 0}, {destination.x, destination.y} );
    const float diagonal_multiplier = 1.0 + (get_option<bool>( "CIRCLEDIST" ) ? (slope * 0.41) : 0.0);
    INFO( monster_type << " " << destination );
    // Wandering makes things nondeterministic, so look at the distribution rather than a target number.
    statistics move_stats;
    for( int i = 0; i < 10; ++i ) {
        move_stats.add( moves_to_destination( monster_type, {0, 0, 0}, destination ) );
        if( (move_stats.avg() / (10000.0 * diagonal_multiplier)) ==
            Approx(1.0).epsilon(0.02) ) {
            break;
        }
    }
    CAPTURE(slope);
    CAPTURE(move_stats.avg());
    INFO(diagonal_multiplier);
    CHECK( (move_stats.avg() / (10000.0 * diagonal_multiplier)) ==
           Approx(1.0).epsilon(0.02) );
}
示例#10
0
void IS_UNIFORM(
    const arma::Col<double>& actualData,
    const double expectedLowerBound,
    const double expectedUpperBound) {
  REQUIRE(arma::all(expectedLowerBound <= actualData));
  REQUIRE(arma::all(actualData <= expectedUpperBound));

  const arma::uword numberOfBins = 10;
  CAPTURE(numberOfBins);

  const double binDistance = (expectedUpperBound - expectedLowerBound) / numberOfBins;
  CAPTURE(binDistance);

  const arma::Col<double>& bins = arma::linspace<arma::Col<double>>(expectedLowerBound, expectedUpperBound - binDistance, numberOfBins) + binDistance / 2;
  CAPTURE(bins);

  const arma::Col<arma::uword>& histogram = arma::hist(actualData, bins);
  CAPTURE(histogram);

  REQUIRE((histogram.max() - histogram.min()) < static_cast<arma::uword>(0.05 * static_cast<double>(actualData.n_elem)));
}
示例#11
0
static void test_shooting_scenario( npc &shooter, int min_quickdraw_range,
                                    int min_good_range, int max_good_range )
{
    {
        dispersion_sources dispersion = get_dispersion( shooter, 0 );
        std::array<statistics, 5> minimum_stats = firing_test( dispersion, min_quickdraw_range, {{ 0.2, 0.1, -1, -1, -1 }} );
        INFO( dispersion );
        INFO( "Range: " << min_quickdraw_range );
        INFO( "Max aim speed: " << shooter.aim_per_move( shooter.weapon, MAX_RECOIL ) );
        INFO( "Min aim speed: " << shooter.aim_per_move( shooter.weapon, shooter.recoil ) );
        CAPTURE( minimum_stats[0].n() );
        CAPTURE( minimum_stats[0].adj_wald_error() );
        CAPTURE( minimum_stats[1].n() );
        CAPTURE( minimum_stats[1].adj_wald_error() );
        CHECK( minimum_stats[0].avg() < 0.2 );
        CHECK( minimum_stats[1].avg() < 0.1 );
    }
    {
        dispersion_sources dispersion = get_dispersion( shooter, 300 );
        std::array<statistics, 5> good_stats = firing_test( dispersion, min_good_range, {{ -1, -1, 0.5, -1, -1 }} );
        INFO( dispersion );
        INFO( "Range: " << min_good_range );
        INFO( "Max aim speed: " << shooter.aim_per_move( shooter.weapon, MAX_RECOIL ) );
        INFO( "Min aim speed: " << shooter.aim_per_move( shooter.weapon, shooter.recoil ) );
        CAPTURE( good_stats[2].n() );
        CAPTURE( good_stats[2].adj_wald_error() );
        CHECK( good_stats[2].avg() > 0.5 );
    }
    {
        dispersion_sources dispersion = get_dispersion( shooter, 500 );
        std::array<statistics, 5> good_stats = firing_test( dispersion, max_good_range, {{ -1, -1, 0.1, -1, -1 }} );
        INFO( dispersion );
        INFO( "Range: " << max_good_range );
        INFO( "Max aim speed: " << shooter.aim_per_move( shooter.weapon, MAX_RECOIL ) );
        INFO( "Min aim speed: " << shooter.aim_per_move( shooter.weapon, shooter.recoil ) );
        CAPTURE( good_stats[2].n() );
        CAPTURE( good_stats[2].adj_wald_error() );
        CHECK( good_stats[2].avg() < 0.1 );
    }
}
示例#12
0
static void test_fast_shooting( npc &shooter, int moves, float hit_rate )
{
    const int fast_shooting_range = 3;
    const float hit_rate_cap = hit_rate + 0.3;
    dispersion_sources dispersion = get_dispersion( shooter, moves );
    std::array<statistics, 5> fast_stats = firing_test( dispersion, fast_shooting_range, {{ -1, hit_rate, -1, -1, -1 }} );
    std::array<statistics, 5> fast_stats_upper = firing_test( dispersion, fast_shooting_range, {{ -1, hit_rate_cap, -1, -1, -1 }} );
    INFO( dispersion );
    INFO( "Range: " << fast_shooting_range );
    INFO( "Max aim speed: " << shooter.aim_per_move( shooter.weapon, MAX_RECOIL ) );
    INFO( "Min aim speed: " << shooter.aim_per_move( shooter.weapon, shooter.recoil ) );
    CAPTURE( shooter.weapon.gun_skill().str() );
    CAPTURE( shooter.get_skill_level( shooter.weapon.gun_skill() ) );
    CAPTURE( shooter.get_dex() );
    CAPTURE( to_milliliter( shooter.weapon.volume() ) );
    CAPTURE( fast_stats[1].n() );
    CAPTURE( fast_stats[1].adj_wald_error() );
    CHECK( fast_stats[1].avg() > hit_rate );
    CAPTURE( fast_stats_upper[1].n() );
    CAPTURE( fast_stats_upper[1].adj_wald_error() );
    CHECK( fast_stats_upper[1].avg() < hit_rate_cap );
}
示例#13
0
文件: TestMain.cpp 项目: offa/keygen
    void reporter<specialized>::send(severity s, const char* file, unsigned long line, const char* msg)
    {
        std::ostringstream os;

        if( line )
        {
            os << file << ':' << line << '\n';
        }

        os << msg;
        const  auto failure = os.str();

        if( s == severity::fatal )
        {
            FAIL(failure);
        }
        else
        {
            CAPTURE(failure);
            CHECK(failure.empty());
        }
    }
示例#14
0
static SECStatus
der_TimeStringToTime(PRTime *dst, const char * string, int generalized)
{
    PRExplodedTime genTime;
    long hourOff = 0, minOff = 0;
    uint16 century;
    char signum;

    if (string == NULL || dst == NULL) {
	PORT_SetError(SEC_ERROR_INVALID_ARGS);
	return SECFailure;
    }

    /* Verify time is formatted properly and capture information */
    memset(&genTime, 0, sizeof genTime);

    if (generalized == UTC_STRING) {
	CAPTURE(genTime.tm_year, string, loser);
	century = (genTime.tm_year < 50) ? 20 : 19;
    } else {
	CAPTURE(century, string, loser);
	CAPTURE(genTime.tm_year, string, loser);
    }
    genTime.tm_year += century * 100;

    CAPTURE(genTime.tm_month, string, loser);
    if ((genTime.tm_month == 0) || (genTime.tm_month > 12)) 
    	goto loser;

    /* NSPR month base is 0 */
    --genTime.tm_month;
    
    CAPTURE(genTime.tm_mday, string, loser);
    if ((genTime.tm_mday == 0) || (genTime.tm_mday > 31)) 
    	goto loser;
    
    CAPTURE(genTime.tm_hour, string, loser);
    if (genTime.tm_hour > 23) 
    	goto loser;
    
    CAPTURE(genTime.tm_min, string, loser);
    if (genTime.tm_min > 59) 
    	goto loser;
    
    if (ISDIGIT(string[0])) {
	CAPTURE(genTime.tm_sec, string, loser);
	if (genTime.tm_sec > 59) 
	    goto loser;
    }
    signum = *string++;
    if (signum == '+' || signum == '-') {
	CAPTURE(hourOff, string, loser);
	if (hourOff > 23) 
	    goto loser;
	CAPTURE(minOff, string, loser);
	if (minOff > 59) 
	    goto loser;
	if (signum == '-') {
	    hourOff = -hourOff;
	    minOff  = -minOff;
	}
    } else if (signum != 'Z') {
	goto loser;
    }

    /* Convert the GMT offset to seconds and save it in genTime
     * for the implode time call.
     */
    genTime.tm_params.tp_gmt_offset = (PRInt32)((hourOff * 60L + minOff) * 60L);
    *dst = PR_ImplodeTime(&genTime);
    return SECSuccess;

loser:
    PORT_SetError(SEC_ERROR_INVALID_TIME);
    return SECFailure;
}
void statsd_parser_exec(statsd_parser *parser, const char *buffer, size_t len) {
  const char *p, *pe;
  int cs = parser->cs;

  p = buffer;
  pe = buffer+len;

  /* Exec */
  
#line 81 "ext/statsd/statsd_parser.c"
	{
	if ( p == pe )
		goto _test_eof;
	switch ( cs )
	{
tr12:
#line 20 "ext/statsd/statsd_parser.c.rl"
	{ EMIT(COUNTER); }
	goto st13;
tr15:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
#line 17 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(sample_rate, p); }
#line 20 "ext/statsd/statsd_parser.c.rl"
	{ EMIT(COUNTER); }
	goto st13;
tr18:
#line 17 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(sample_rate, p); }
#line 20 "ext/statsd/statsd_parser.c.rl"
	{ EMIT(COUNTER); }
	goto st13;
tr21:
#line 18 "ext/statsd/statsd_parser.c.rl"
	{ EMIT(GAUGE); }
	goto st13;
tr23:
#line 19 "ext/statsd/statsd_parser.c.rl"
	{ EMIT(TIMER); }
	goto st13;
st13:
	if ( ++p == pe )
		goto _test_eof13;
case 13:
#line 117 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto tr25;
		case 58: goto tr26;
	}
	goto tr24;
tr24:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
	goto st0;
st0:
	if ( ++p == pe )
		goto _test_eof0;
case 0:
#line 131 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto st14;
		case 58: goto tr2;
	}
	goto st0;
tr25:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
	goto st14;
st14:
	if ( ++p == pe )
		goto _test_eof14;
case 14:
#line 145 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto tr25;
		case 58: goto tr27;
	}
	goto tr24;
tr2:
#line 15 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(name, p); }
	goto st1;
tr26:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
#line 15 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(name, p); }
	goto st1;
tr27:
#line 15 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(name, p); }
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
	goto st1;
st1:
	if ( ++p == pe )
		goto _test_eof1;
case 1:
#line 171 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto st13;
		case 45: goto tr5;
		case 124: goto tr6;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr5;
	goto st2;
st2:
	if ( ++p == pe )
		goto _test_eof2;
case 2:
	if ( (*p) == 10 )
		goto st13;
	goto st2;
tr5:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
	goto st3;
st3:
	if ( ++p == pe )
		goto _test_eof3;
case 3:
#line 195 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto st13;
		case 124: goto tr8;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto st3;
	goto st2;
tr6:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
#line 16 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(value, p); }
	goto st4;
tr8:
#line 16 "ext/statsd/statsd_parser.c.rl"
	{ CAPTURE(value, p); }
	goto st4;
st4:
	if ( ++p == pe )
		goto _test_eof4;
case 4:
#line 217 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto st13;
		case 99: goto st5;
		case 103: goto st10;
		case 109: goto st11;
	}
	goto st2;
st5:
	if ( ++p == pe )
		goto _test_eof5;
case 5:
	switch( (*p) ) {
		case 10: goto tr12;
		case 124: goto st6;
	}
	goto st2;
st6:
	if ( ++p == pe )
		goto _test_eof6;
case 6:
	switch( (*p) ) {
		case 10: goto st13;
		case 64: goto st7;
	}
	goto st2;
st7:
	if ( ++p == pe )
		goto _test_eof7;
case 7:
	switch( (*p) ) {
		case 10: goto tr15;
		case 45: goto tr16;
		case 46: goto tr17;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr16;
	goto st2;
tr16:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
	goto st8;
st8:
	if ( ++p == pe )
		goto _test_eof8;
case 8:
#line 263 "ext/statsd/statsd_parser.c"
	switch( (*p) ) {
		case 10: goto tr18;
		case 46: goto st9;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto st8;
	goto st2;
tr17:
#line 14 "ext/statsd/statsd_parser.c.rl"
	{ MARK(p); }
	goto st9;
st9:
	if ( ++p == pe )
		goto _test_eof9;
case 9:
#line 279 "ext/statsd/statsd_parser.c"
	if ( (*p) == 10 )
		goto tr18;
	if ( 48 <= (*p) && (*p) <= 57 )
		goto st9;
	goto st2;
st10:
	if ( ++p == pe )
		goto _test_eof10;
case 10:
	if ( (*p) == 10 )
		goto tr21;
	goto st2;
st11:
	if ( ++p == pe )
		goto _test_eof11;
case 11:
	switch( (*p) ) {
		case 10: goto st13;
		case 115: goto st12;
	}
	goto st2;
st12:
	if ( ++p == pe )
		goto _test_eof12;
case 12:
	if ( (*p) == 10 )
		goto tr23;
	goto st2;
	}
	_test_eof13: cs = 13; goto _test_eof; 
	_test_eof0: cs = 0; goto _test_eof; 
	_test_eof14: cs = 14; goto _test_eof; 
	_test_eof1: cs = 1; goto _test_eof; 
	_test_eof2: cs = 2; goto _test_eof; 
	_test_eof3: cs = 3; goto _test_eof; 
	_test_eof4: cs = 4; goto _test_eof; 
	_test_eof5: cs = 5; goto _test_eof; 
	_test_eof6: cs = 6; goto _test_eof; 
	_test_eof7: cs = 7; goto _test_eof; 
	_test_eof8: cs = 8; goto _test_eof; 
	_test_eof9: cs = 9; goto _test_eof; 
	_test_eof10: cs = 10; goto _test_eof; 
	_test_eof11: cs = 11; goto _test_eof; 
	_test_eof12: cs = 12; goto _test_eof; 

	_test_eof: {}
	}

#line 73 "ext/statsd/statsd_parser.c.rl"
}
示例#16
0
static OSStatus
DER_UTCTimeToCFDate(const CSSM_DATA_PTR utcTime, CFAbsoluteTime *date)
{
    CFGregorianDate gdate;
    char *string = (char *)utcTime->Data;
    long year, month, mday, hour, minute, second, hourOff, minOff;
    CFTimeZoneRef timeZone;

    /* Verify time is formatted properly and capture information */
    second = 0;
    hourOff = 0;
    minOff = 0;
    CAPTURE(year,string+0,loser);
    if (year < 50) {
        /* ASSUME that year # is in the 2000's, not the 1900's */
        year += 100;
    }
    CAPTURE(month,string+2,loser);
    if ((month == 0) || (month > 12)) goto loser;
    CAPTURE(mday,string+4,loser);
    if ((mday == 0) || (mday > 31)) goto loser;
    CAPTURE(hour,string+6,loser);
    if (hour > 23) goto loser;
    CAPTURE(minute,string+8,loser);
    if (minute > 59) goto loser;
    if (ISDIGIT(string[10])) {
        CAPTURE(second,string+10,loser);
        if (second > 59) goto loser;
        string += 2;
    }
    if (string[10] == '+') {
        CAPTURE(hourOff,string+11,loser);
        if (hourOff > 23) goto loser;
        CAPTURE(minOff,string+13,loser);
        if (minOff > 59) goto loser;
    } else if (string[10] == '-') {
        CAPTURE(hourOff,string+11,loser);
        if (hourOff > 23) goto loser;
        hourOff = -hourOff;
        CAPTURE(minOff,string+13,loser);
        if (minOff > 59) goto loser;
        minOff = -minOff;
    } else if (string[10] != 'Z') {
        goto loser;
    }

    gdate.year = (SInt32)(year + 1900);
    gdate.month = month;
    gdate.day = mday;
    gdate.hour = hour;
    gdate.minute = minute;
    gdate.second = second;

    if (hourOff == 0 && minOff == 0)
	timeZone = NULL; /* GMT */
    else
    {
	timeZone = CFTimeZoneCreateWithTimeIntervalFromGMT(NULL, (hourOff * 60 + minOff) * 60);
    }

    *date = CFGregorianDateGetAbsoluteTime(gdate, timeZone);
    if (timeZone)
	CFRelease(timeZone);

    return SECSuccess;

loser:
    return SECFailure;
}