19c6d7c21Sopenharmony_ci/*
29c6d7c21Sopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
39c6d7c21Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49c6d7c21Sopenharmony_ci * you may not use this file except in compliance with the License.
59c6d7c21Sopenharmony_ci * You may obtain a copy of the License at
69c6d7c21Sopenharmony_ci *
79c6d7c21Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89c6d7c21Sopenharmony_ci *
99c6d7c21Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109c6d7c21Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119c6d7c21Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129c6d7c21Sopenharmony_ci * See the License for the specific language governing permissions and
139c6d7c21Sopenharmony_ci * limitations under the License.
149c6d7c21Sopenharmony_ci */
159c6d7c21Sopenharmony_ci#include "time_adapter.h"
169c6d7c21Sopenharmony_ci#include <ohos_errno.h>
179c6d7c21Sopenharmony_ci#include <time.h>
189c6d7c21Sopenharmony_ci
199c6d7c21Sopenharmony_ci#define MS_PER_SECOND 1000
209c6d7c21Sopenharmony_ci#define NS_PER_MS 1000000
219c6d7c21Sopenharmony_ci
229c6d7c21Sopenharmony_ciint32 WDT_Start(uint32 ms)
239c6d7c21Sopenharmony_ci{
249c6d7c21Sopenharmony_ci    return WDT_Reset(ms);
259c6d7c21Sopenharmony_ci}
269c6d7c21Sopenharmony_ci
279c6d7c21Sopenharmony_ciint32 WDT_Reset(uint32 ms)
289c6d7c21Sopenharmony_ci{
299c6d7c21Sopenharmony_ci    (void)ms;
309c6d7c21Sopenharmony_ci    return EC_FAILURE;
319c6d7c21Sopenharmony_ci}
329c6d7c21Sopenharmony_ci
339c6d7c21Sopenharmony_ciint32 WDT_Stop(void)
349c6d7c21Sopenharmony_ci{
359c6d7c21Sopenharmony_ci    return EC_FAILURE;
369c6d7c21Sopenharmony_ci}
379c6d7c21Sopenharmony_ci
389c6d7c21Sopenharmony_ciuint64 SAMGR_GetProcessTime(void)
399c6d7c21Sopenharmony_ci{
409c6d7c21Sopenharmony_ci    struct timespec ts = {0, 0};
419c6d7c21Sopenharmony_ci    clock_gettime(CLOCK_REALTIME, &ts);
429c6d7c21Sopenharmony_ci    return ((ts.tv_sec * MS_PER_SECOND) + (ts.tv_nsec / NS_PER_MS));
439c6d7c21Sopenharmony_ci}
44