示例#1
0
static Variant HHVM_METHOD(IntlTimeZone, getID) {
  TZ_GET(data, this_, false);
  icu::UnicodeString id;
  data->timezone()->getID(id);
  UErrorCode error = U_ZERO_ERROR;
  String ret(u8(id, error));
  if (U_FAILURE(error)) {
    s_intl_error->set(error, "intltz_get_id: Could not convert id to UTF-8");
    return false;
  }
  return ret;
}
示例#2
0
static bool HHVM_METHOD(IntlTimeZone, getOffset,
                        double date, bool local,
                        VRefParam rawOffset, VRefParam dstOffset) {
  TZ_GET(data, this_, false);
  UErrorCode error = U_ZERO_ERROR;
  int32_t rawOff, dstOff;
  data->timezone()->getOffset(date, (UBool)local, rawOff, dstOff, error);
  if (U_FAILURE(error)) {
    data->setError(error, "intltz_get_offset: error obtaining offset");
    return false;
  }
  rawOffset = rawOff;
  dstOffset = dstOff;
  return true;
}
示例#3
0
static Variant HHVM_METHOD(IntlTimeZone, getDisplayName,
                           bool isDaylight, int64_t style,
                           const String& locale) {
  if (!IntlTimeZone::isValidStyle(style)) {
    s_intl_error->set(U_ILLEGAL_ARGUMENT_ERROR,
                      "intltz_get_display_name: wrong display type");
    return false;
  }
  TZ_GET(data, this_, false);
  icu::UnicodeString result;
  data->timezone()->getDisplayName((UBool)isDaylight,
                                   (icu::TimeZone::EDisplayType)style,
                                    icu::Locale::createFromName(
                                     localeOrDefault(locale).c_str()),
                                   result);
  UErrorCode error = U_ZERO_ERROR;
  String ret(u8(result, error));
  TZ_CHECK(data, error, false);
  return ret;
}
示例#4
0
static bool HHVM_METHOD(IntlTimeZone, useDaylightTime) {
  TZ_GET(data, this_, false);
  return data->timezone()->useDaylightTime();
}
示例#5
0
static bool HHVM_METHOD(IntlTimeZone, hasSameRules, CObjRef otherTimeZone) {
  TZ_GET(obj1, this_, false);
  TZ_GET(obj2, otherTimeZone, false);
  return obj1->timezone()->hasSameRules(*obj2->timezone());
}
示例#6
0
static Variant HHVM_METHOD(IntlTimeZone, getRawOffset) {
  TZ_GET(data, this_, false);
  return data->timezone()->getRawOffset();
}
示例#7
0
static String HHVM_METHOD(IntlTimeZone, getErrorMessage) {
  TZ_GET(data, this_, null_string);
  return data->getErrorMessage();
}
示例#8
0
static int64_t HHVM_METHOD(IntlTimeZone, getErrorCode) {
  TZ_GET(data, this_, 0);
  return data->getErrorCode();
}
示例#9
0
static int64_t HHVM_METHOD(IntlTimeZone, getDSTSavings) {
  TZ_GET(data, this_, -1);
  return data->timezone()->getDSTSavings();
}
示例#10
0
static bool HHVM_METHOD(IntlTimeZone, hasSameRules, const Object& otherTimeZone) {
  TZ_GET(obj1, this_, false);
  TZ_GET(obj2, otherTimeZone.get(), false);
  return obj1->timezone()->hasSameRules(*obj2->timezone());
}