Logo Search packages:      
Sourcecode: icu version File versions

void SimpleDateFormat::appendGMT ( NumberFormat currentNumberFormat,
UnicodeString appendTo,
Calendar cal,
UErrorCode status 
) const [private]

Private methods for formatting/parsing GMT string

Definition at line 992 of file smpdtfmt.cpp.

References DateFormatSymbols::fGmtZero, MessageFormat::format(), fSymbols, Calendar::get(), U_FAILURE, U_MILLIS_PER_MINUTE, U_SUCCESS, UCAL_DST_OFFSET, and UCAL_ZONE_OFFSET.

Referenced by subFormat().

                                                                                                                             {
    int32_t offset = cal.get(UCAL_ZONE_OFFSET, status) + cal.get(UCAL_DST_OFFSET, status);
    if (U_FAILURE(status)) {
        return;
    }
    if (offset == 0) {
        // use GMT zero format
        appendTo += fSymbols->fGmtZero;
    } else {
        if (isDefaultGMTFormat()) {
            formatGMTDefault(currentNumberFormat,appendTo, offset);
        } else {
            ((SimpleDateFormat*)this)->initGMTFormatters(status);
            if (U_SUCCESS(status)) {
                int32_t type;
                if (offset < 0) {
                    offset = -offset;
                    type = (offset % U_MILLIS_PER_MINUTE) == 0 ? kGMTNegativeHM : kGMTNegativeHMS;
                } else {
                    type = (offset % U_MILLIS_PER_MINUTE) == 0 ? kGMTPositiveHM : kGMTPositiveHMS;
                }
                Formattable param(offset, Formattable::kIsDate);
                FieldPosition fpos(0);
                fGMTFormatters[type]->format(&param, 1, appendTo, fpos, status);
            }
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index