summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp
blob: 6a74d45946d1e0d8371e90ecb41eec0e9cc1d6d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "core/hle/service/psc/time/clocks/standard_local_system_clock_core.h"

namespace Service::PSC::Time {

void StandardLocalSystemClockCore::Initialize(const SystemClockContext& context, s64 time) {
    SteadyClockTimePoint time_point{};
    if (GetCurrentTimePoint(time_point) == ResultSuccess &&
        context.steady_time_point.IdMatches(time_point)) {
        SetContextAndWrite(context);
    } else if (SetCurrentTime(time) != ResultSuccess) {
        LOG_ERROR(Service_Time, "Failed to SetCurrentTime");
    }

    SetInitialized();
}

} // namespace Service::PSC::Time