12dc7c57fSopenharmony_ci/*
22dc7c57fSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
32dc7c57fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42dc7c57fSopenharmony_ci * you may not use this file except in compliance with the License.
52dc7c57fSopenharmony_ci * You may obtain a copy of the License at
62dc7c57fSopenharmony_ci *
72dc7c57fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
82dc7c57fSopenharmony_ci *
92dc7c57fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102dc7c57fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112dc7c57fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122dc7c57fSopenharmony_ci * See the License for the specific language governing permissions and
132dc7c57fSopenharmony_ci * limitations under the License.
142dc7c57fSopenharmony_ci */
152dc7c57fSopenharmony_ci
162dc7c57fSopenharmony_ci#include "system_time.h"
172dc7c57fSopenharmony_ci
182dc7c57fSopenharmony_ci#include "event_log_wrapper.h"
192dc7c57fSopenharmony_ci#include "inner_event.h"
202dc7c57fSopenharmony_ci
212dc7c57fSopenharmony_cinamespace OHOS {
222dc7c57fSopenharmony_cinamespace EventFwk {
232dc7c57fSopenharmony_ciusing namespace OHOS::AppExecFwk;
242dc7c57fSopenharmony_ci
252dc7c57fSopenharmony_ciint64_t SystemTime::GetNowSysTime()
262dc7c57fSopenharmony_ci{
272dc7c57fSopenharmony_ci    EVENT_LOGD("enter");
282dc7c57fSopenharmony_ci
292dc7c57fSopenharmony_ci    InnerEvent::TimePoint nowSys = InnerEvent::Clock::now();
302dc7c57fSopenharmony_ci    auto epoch = nowSys.time_since_epoch();
312dc7c57fSopenharmony_ci    auto value = std::chrono::duration_cast<std::chrono::milliseconds>(epoch);
322dc7c57fSopenharmony_ci    int64_t duration = value.count();
332dc7c57fSopenharmony_ci
342dc7c57fSopenharmony_ci    return duration;
352dc7c57fSopenharmony_ci}
362dc7c57fSopenharmony_ci}  // namespace EventFwk
372dc7c57fSopenharmony_ci}  // namespace OHOS