示例#1
0
文件: time.c 项目: ohmann/checkapi
APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *t,
                                               apr_time_exp_t *xt)
{
    apr_status_t status = apr_time_exp_get(t, xt);
    if (status == APR_SUCCESS)
        *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC;
    return status;
}
示例#2
0
/* 0.9.4 and earlier rejected valid dates in 2038 */
static void test_2038(CuTest *tc)
{
    apr_time_exp_t xt;
    apr_time_t t;

    /* 2038-01-19T03:14:07.000000Z */
    xt.tm_year = 138;
    xt.tm_mon = 0;
    xt.tm_mday = 19;
    xt.tm_hour = 3;
    xt.tm_min = 14;
    xt.tm_sec = 7;
    
    apr_assert_success(tc, "explode January 19th, 2038",
                       apr_time_exp_get(&t, &xt));
}
示例#3
0
static void test_exp_get_lt(CuTest *tc)
{
    apr_status_t rv;
    apr_time_exp_t xt;
    apr_time_t imp;
    apr_int64_t hr_off_64;

    rv = apr_time_exp_lt(&xt, now);
    CuAssertTrue(tc, rv == APR_SUCCESS);
    rv = apr_time_exp_get(&imp, &xt);
    if (rv == APR_ENOTIMPL) {
        CuNotImpl(tc, "apr_time_exp_get");
    }
    CuAssertTrue(tc, rv == APR_SUCCESS);
    hr_off_64 = (apr_int64_t) xt.tm_gmtoff * APR_USEC_PER_SEC;
    CuAssertTrue(tc, now + hr_off_64 == imp);
}
示例#4
0
文件: time.c 项目: LuaDist/lua-apr
apr_time_t time_check(lua_State *L, int idx)
{
  if (lua_isnoneornil(L, idx)) {
    return apr_time_now();
  } else if (!lua_istable(L, idx)) {
    luaL_checktype(L, idx, LUA_TNUMBER);
    return time_get(L, idx);
  } else {
    apr_time_t time;
    apr_status_t status;
    apr_time_exp_t components;
    time_check_exploded(L, idx, &components, 1);
    status = apr_time_exp_get(&time, &components);
    if (status != APR_SUCCESS)
      raise_error_status(L, status);
    return time;
  }
}
示例#5
0
文件: switch_apr.c 项目: gujun/sscore
SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
{
	return apr_time_exp_get((apr_time_t *) result, (apr_time_exp_t *) input);
}