Skip to main content

OH_TimeService_GetTimeZone

Function OH_TimeService_GetTimeZone 

Source
pub unsafe extern "C" fn OH_TimeService_GetTimeZone(
    timeZone: *mut c_char,
    len: u32,
) -> TimeService_ErrCode
Available on crate features time-service and api-12 only.
Expand description

Obtains the current system time zone.

§Arguments

  • timeZone - Pointer to an array of characters indicating the time zone ID. On success, the string indicates the current system time zone ID. On failure, the string is empty. The string is terminated using ’
  • len - Size of the memory allocated for the time zone ID character array. There is no upper limit for the length of the time zone ID. It is recommended to allocate sufficient memory, at least not less than 31 bytes.

§Returns

  • Returns [TIMESERVICE_ERR_OK] if the operation is successful. Returns [TIMESERVICE_ERR_INTERNAL_ERROR] if obtaining the system parameters fails. Returns [TIMESERVICE_ERR_INVALID_PARAMETER] if timeZone is a null pointer or the length of the time zone ID (excluding the terminating character (’is greater than or equal to len.

Required System Capabilities: SystemCapability.MiscServices.Time

Available since API-level: 12