17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci#ifndef TIME_SERVICE_H
177777dab0Sopenharmony_ci#define TIME_SERVICE_H
187777dab0Sopenharmony_ci
197777dab0Sopenharmony_ci/**
207777dab0Sopenharmony_ci * @addtogroup TimeService
217777dab0Sopenharmony_ci * @{
227777dab0Sopenharmony_ci *
237777dab0Sopenharmony_ci * @brief Declares the time zone capabilities provided by TimeService to an application.
247777dab0Sopenharmony_ci * @since 12
257777dab0Sopenharmony_ci */
267777dab0Sopenharmony_ci/**
277777dab0Sopenharmony_ci * @file time_service.h
287777dab0Sopenharmony_ci *
297777dab0Sopenharmony_ci * @brief Declares the APIs for obtaining the time zone information.
307777dab0Sopenharmony_ci * @library libtime_service_ndk.so
317777dab0Sopenharmony_ci * @syscap SystemCapability.MiscServices.Time
327777dab0Sopenharmony_ci * @since 12
337777dab0Sopenharmony_ci */
347777dab0Sopenharmony_ci
357777dab0Sopenharmony_ci#include <stdint.h>
367777dab0Sopenharmony_ci
377777dab0Sopenharmony_ci#ifdef __cplusplus
387777dab0Sopenharmony_ciextern "C" {
397777dab0Sopenharmony_ci#endif
407777dab0Sopenharmony_ci
417777dab0Sopenharmony_ci/**
427777dab0Sopenharmony_ci * @brief Enumerates the error codes.
437777dab0Sopenharmony_ci *
447777dab0Sopenharmony_ci * @since 12
457777dab0Sopenharmony_ci */
467777dab0Sopenharmony_citypedef enum TimeService_ErrCode {
477777dab0Sopenharmony_ci    /** @error Success.*/
487777dab0Sopenharmony_ci    TIMESERVICE_ERR_OK = 0,
497777dab0Sopenharmony_ci
507777dab0Sopenharmony_ci    /** @error Failed to obtain system parameters.*/
517777dab0Sopenharmony_ci    TIMESERVICE_ERR_INTERNAL_ERROR = 13000001,
527777dab0Sopenharmony_ci
537777dab0Sopenharmony_ci    /** @error Invalid parameter.*/
547777dab0Sopenharmony_ci    TIMESERVICE_ERR_INVALID_PARAMETER = 13000002,
557777dab0Sopenharmony_ci} TimeService_ErrCode;
567777dab0Sopenharmony_ci
577777dab0Sopenharmony_ci/**
587777dab0Sopenharmony_ci * @brief Obtains the current system time zone.
597777dab0Sopenharmony_ci *
607777dab0Sopenharmony_ci * @param timeZone Pointer to an array of characters indicating the time zone ID. On success, the string indicates the
617777dab0Sopenharmony_ci *        current system time zone ID. On failure, the string is empty. The string is terminated using '\0'.
627777dab0Sopenharmony_ci * @param len Size of the memory allocated for the time zone ID character array. There is no upper limit for the length
637777dab0Sopenharmony_ci *        of the time zone ID. It is recommended to allocate sufficient memory, at least not less than 31 bytes.
647777dab0Sopenharmony_ci * @return Returns {@link TIMESERVICE_ERR_OK} if the operation is successful.
657777dab0Sopenharmony_ci *         Returns {@link TIMESERVICE_ERR_INTERNAL_ERROR} if obtaining the system parameters fails.
667777dab0Sopenharmony_ci *         Returns {@link TIMESERVICE_ERR_INVALID_PARAMETER} if <b>timeZone</b> is a null pointer or the length of the
677777dab0Sopenharmony_ci *         time zone ID (excluding the terminating character ('\0')) is greater than or equal to <b>len</b>.
687777dab0Sopenharmony_ci * @syscap SystemCapability.MiscServices.Time
697777dab0Sopenharmony_ci * @since 12
707777dab0Sopenharmony_ci */
717777dab0Sopenharmony_ciTimeService_ErrCode OH_TimeService_GetTimeZone(char *timeZone, uint32_t len);
727777dab0Sopenharmony_ci
737777dab0Sopenharmony_ci#ifdef __cplusplus
747777dab0Sopenharmony_ci}
757777dab0Sopenharmony_ci#endif
767777dab0Sopenharmony_ci
777777dab0Sopenharmony_ci/** @} */
787777dab0Sopenharmony_ci
797777dab0Sopenharmony_ci#endif /* TIME_SERVICE_H */