1 /* 2 * Copyright (c) 2020 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 #include "time_adapter.h" 16 #include <ohos_errno.h> 17 #include <time.h> 18 19 #define MS_PER_SECOND 1000 20 #define NS_PER_MS 1000000 21 WDT_Start(uint32 ms)22int32 WDT_Start(uint32 ms) 23 { 24 return WDT_Reset(ms); 25 } 26 WDT_Reset(uint32 ms)27int32 WDT_Reset(uint32 ms) 28 { 29 (void)ms; 30 return EC_FAILURE; 31 } 32 WDT_Stop(void)33int32 WDT_Stop(void) 34 { 35 return EC_FAILURE; 36 } 37 SAMGR_GetProcessTime(void)38uint64 SAMGR_GetProcessTime(void) 39 { 40 struct timespec ts = {0, 0}; 41 clock_gettime(CLOCK_REALTIME, &ts); 42 return ((ts.tv_sec * MS_PER_SECOND) + (ts.tv_nsec / NS_PER_MS)); 43 } 44