A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <chrono> |
| 7 | #include "common/shadpkg_types.h" |
| 8 | |
| 9 | namespace Common { |
| 10 | |
| 11 | class NativeClock final { |
| 12 | public: |
| 13 | explicit NativeClock(); |
| 14 | |
| 15 | u64 GetTscFrequency() const { |
| 16 | return rdtsc_frequency; |
| 17 | } |
| 18 | |
| 19 | u64 GetTimeNS(u64 base_ptc = 0) const; |
| 20 | u64 GetTimeUS(u64 base_ptc = 0) const; |
| 21 | u64 GetTimeMS(u64 base_ptc = 0) const; |
| 22 | u64 GetUptime() const; |
| 23 | |
| 24 | private: |
| 25 | u64 rdtsc_frequency; |
| 26 | u64 ns_rdtsc_factor; |
| 27 | u64 us_rdtsc_factor; |
| 28 | u64 ms_rdtsc_factor; |
| 29 | }; |
| 30 | |
| 31 | } // namespace Common |
| 32 |