1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { AsyncCallback } from "./basic"; 17import Want from "./@ohos.app.ability.Want"; 18 19/** 20 * This module provides the capability to manage the datetime of the enterprise devices. 21 * @namespace dateTimeManager. 22 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 23 * @systemapi 24 * @since 9 25 */ 26declare namespace dateTimeManager { 27 28 /** 29 * Sets the system time. 30 * This function can be called by a super administrator. 31 * @permission ohos.permission.ENTERPRISE_SET_DATETIME 32 * @param { Want } admin - admin indicates the administrator ability information. 33 * @param { number } time - time indicates the target time stamp (ms). 34 * @param { AsyncCallback<void> } callback - the callback of setDateTime. 35 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 36 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 37 * @throws { BusinessError } 201 - the application does not have permission to call this function. 38 * @throws { BusinessError } 401 - invalid input parameter. 39 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 40 * @systemapi 41 * @StageModelOnly 42 * @since 9 43 */ 44 function setDateTime(admin: Want, time: number, callback: AsyncCallback<void>): void; 45 46 /** 47 * Sets the system time. 48 * This function can be called by a super administrator. 49 * @permission ohos.permission.ENTERPRISE_SET_DATETIME 50 * @param { Want } admin - admin indicates the administrator ability information. 51 * @param { number } time - time indicates the target time stamp (ms). 52 * @returns { Promise<void> } the promise returned by the setDateTime. 53 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 54 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 55 * @throws { BusinessError } 201 - the application does not have permission to call this function. 56 * @throws { BusinessError } 401 - invalid input parameter. 57 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 58 * @systemapi 59 * @StageModelOnly 60 * @since 9 61 */ 62 function setDateTime(admin: Want, time: number): Promise<void>; 63} 64 65export default dateTimeManager;