Logo Search packages:      
Sourcecode: icu version File versions  Download package

TimeZone * TimeZone::createCustomTimeZone ( const UnicodeString id  )  [static, private]

Parse a custom time zone identifier and return a corresponding zone.

id a string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or GMT[+-]hh.
a newly created SimpleTimeZone with the given offset and no Daylight Savings Time, or null if the id cannot be parsed.

Definition at line 1277 of file timezone.cpp.

References formatCustomID(), NULL, and parseCustomID().

Referenced by createTimeZone().

    int32_t sign, hour, min, sec;
    if (parseCustomID(id, sign, hour, min, sec)) {
        UnicodeString customID;
        formatCustomID(hour, min, sec, (sign < 0), customID);
        int32_t offset = sign * ((hour * 60 + min) * 60 + sec) * 1000;
        return new SimpleTimeZone(offset, customID);
    return NULL;

Generated by  Doxygen 1.6.0   Back to index