diff -r 80ef3a206772 -r 48780e181b38 Symbian3/SDK/Source/GUID-DF4D7DFF-ECA9-40CF-9F3B-4BBC3F8162E4.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-DF4D7DFF-ECA9-40CF-9F3B-4BBC3F8162E4.dita Tue Jul 20 12:00:49 2010 +0100 @@ -0,0 +1,56 @@ + + + + + +Converting +between UTC and local time +
Time zone ID +

Each time zone is uniquely identified by its time zone ID which is +a numeric reference or a name. The CTzId class encapsulates +a time zone identifier. A time zone ID is created using the CTzId::NewL() factory +method, for example:

_LIT8( KAsiaHongKong,"Asia/Hong_Kong" ); //A valid time zone name +CTzId* zoneId = CTzId::NewL( KAsiaHongKong );

The time zone’s +numeric ID or name can be retrieved using CTzId::TimeZoneNumericID() or CTzId::TimeZoneNameID() respectively. +

operator==() and operator!=() can +be used to check if the time zone ID matches or differs from another time +zone ID.

+
Converting +between UTC and local time

You can convert between times expressed +in UTC and local time using either the CTzConverter or RTz class. +

CTzConverter does the conversion on the client +side by caching rules which it gets from the time zone server. This class +should be used for conversion between UTC and local time for the system time +zone, for performance reasons.

If the conversion involves foreign +time zones, the RTz class can be used instead.

The +following types of time conversion are possible:

    +
  • UTC +to local time in any time zone

  • +
  • UTC +to local time in the system time zone

  • +
  • Local +time in the system time zone to UTC

  • +
  • Local +time in any time zone to UTC

  • +
+
Setting the +local time

RTz::SetHomeTime() sets the local +time in the system time zone:

_LIT8( KMyTime, "20050105:103000.00" ); // Local time to set (5th January 2005 10:30 hrs). +TTime myTime( KMyTime ); //Create the time as a TTime object +TInt errCode = myTZoneServer.SetHomeTime( myTime );

The WriteDeviceData capability +is needed to set the system time.

+
Automatic UTC +offset

Whenever DST begins or ends, the UTC offset needs to be updated +accordingly. This can be done automatically by calling RTz::SetAutoUpdateBehaviorL(). +This function takes a value from the TTzAutoDSTUpdateModes enum. +When set to TTzAutoDSTUpdateModes::ETZAutoDSTUpdateOn(), +the UTC offset is automatically updated for changes to DST.

+
See also

Time zone conversion overview

timezoneconversion: Using +the time zone server

+
\ No newline at end of file