This tutorial describes how a client uses CTzUserData to manage user data. CTzLocalizer enables a client to get existing localized time zone names.
The steps for a client to create a user-defined TZ from an existing TZ are described in the Procedure section.
This is illustrated in the code example that follows.
#include <tzlocalizer.h> // For CTzLocalizer etc. #include <tz.h> // For CTzUserData etc. #include <…> … // This numeric TZID would typically be supplied by the UI layer. TInt existingTzId = 1234; // Get localized TZ names for existing TZ. CTzLocalizer* tzLocalizer = CTzLocalizer::NewL(); CTzLocalizedTimeZone* localizedTz = tzLocalizer-> GetLocalizedTimeZoneL( existingTzId ); CTzLocalizedCity* localizedCity = tzLocalizer-> GetDefaultCityL( localizedTz ); CTzLocalizedCityGroup* localizedGroup = tzLocalizer-> GetCityGroupL( localizedCity->GroupId() ); // Create user-defined TZ names object. CTzUserNames* tzNames = CTzUserNames::NewL( localizedTz->StandardName(), localizedTz->ShortStandardName(), localizedTz->DaylightName(), localizedTz->ShortDaylightName(), localizedCity->Name(), localizedGroup ->Name() ); // Connect to TZ Server. RTz tzServer; User::LeaveIfError( tzServer.Connect() ); // Get the TZ rules for the existing TZ. CTzId* tzId = CTzId::NewL( existingTzId ); TTime startTime( TDateTime( 0,EJanuary,0,0,0,0,0 ) ); // Get all the TTime endTime( TDateTime( 9999,EDecember,30,23,59,59,0 ) ); // TZ rules. CTzRules* tzRules = tzServer.GetTimeZoneRulesL( *tzId, startTime, endTime, ETzUtcTimeReference ); // Create user-defined TZ. CTzUserData* tzUserData = CTzUserData::NewL( tzServer ); CTzId* userTzId = tzUserData->CreateL( *tzRules, *tzNames ); …
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.