diff -r 80ef3a206772 -r 48780e181b38 Symbian3/SDK/Source/GUID-E0D4EFAC-85E6-4EF6-B65C-1D1602E3A8FD.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-E0D4EFAC-85E6-4EF6-B65C-1D1602E3A8FD.dita Tue Jul 20 12:00:49 2010 +0100 @@ -0,0 +1,81 @@ + + + + + +Creating +a User-Defined Time Zone from an Existing Time Zone +

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.

+ +Include the header +files that contain the CTzLocalizer and CTzUserData classes. + +Include a numeric time zone ID. This is supplied by the UI layer. + +Get the localized TZ names for the existing time zone (specified +by the TZID) using CTzLocalizer::GetLocalizedTimeZoneL(TInt). + +Create a user-defined TZ names object using CTzUserNames::NewL(). + +Connect to the TZ Server using RTz::Connect(). + +Get all the TZ rules for the existing time zone using RTz::GetTimeZoneRulesL(). + +Create the user-defined TZ using CTzUserData::CreateL(). + + +

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 ); + +…
+
+Subscribe +and Respond to TZ Data Changes +
\ No newline at end of file