示例#1
0
/**
 * call-seq:
 *      UCalendar.dst_savings(zone_id)
 *
 * Return the amount of time in milliseconds that the clock is advanced 
 * during daylight  savings time for the given time zone, or zero if the time 
 * zone does not observe daylight savings time. 
 *
 *       UCalendar.dst_savings("GMT+00".u) # =>  3600000
 *
 */
VALUE icu4r_cal_dst_savings(VALUE obj, VALUE zone) 
{
	UErrorCode  status = U_ZERO_ERROR;
	int32_t dst;
	Check_Class(zone, rb_cUString);
  	dst = ucal_getDSTSavings (ICU_PTR(zone), &status);
	ICU_RAISE(status);
	return INT2FIX(dst);
}
// Qt wrapper around ucal_getDSTSavings()
static int ucalDaylightOffset(const QByteArray &id)
{
    UErrorCode status = U_ZERO_ERROR;
    const int32_t dstMSecs = ucal_getDSTSavings(reinterpret_cast<const UChar *>(id.data()), &status);
    if (U_SUCCESS(status))
        return (dstMSecs / 1000);
    else
        return 0;
}