mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-09 07:35:41 +12:00
Merge branch 'master' into dynapica
This commit is contained in:
commit
a86bd12423
3 changed files with 19 additions and 10 deletions
5
.github/workflows/MacOS_Build.yml
vendored
5
.github/workflows/MacOS_Build.yml
vendored
|
@ -23,13 +23,10 @@ jobs:
|
||||||
- name: Fetch submodules
|
- name: Fetch submodules
|
||||||
run: git submodule update --init --recursive
|
run: git submodule update --init --recursive
|
||||||
|
|
||||||
- name: Install LLVM # MacOS comes with "AppleClang" instead of regular Clang, and it can't build the project because no proper C++20
|
|
||||||
run: brew install llvm
|
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ -DENABLE_USER_BUILD=ON
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_USER_BUILD=ON
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
# Build your program with the given configuration
|
# Build your program with the given configuration
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#Clion Files
|
#Clion Files
|
||||||
.idea/
|
.idea/
|
||||||
cmake-build-*
|
cmake-build-*/
|
||||||
|
|
||||||
Debug/
|
Debug/
|
||||||
Release/
|
Release/
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "resource_limits.hpp"
|
#include "resource_limits.hpp"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <chrono> // For time since epoch
|
#include <chrono> // For time since epoch
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
using namespace KernelMemoryTypes;
|
using namespace KernelMemoryTypes;
|
||||||
|
|
||||||
|
@ -424,9 +425,20 @@ void Memory::mirrorMapping(u32 destAddress, u32 sourceAddress, u32 size) {
|
||||||
u64 Memory::timeSince3DSEpoch() {
|
u64 Memory::timeSince3DSEpoch() {
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
||||||
// ms since Jan 1 1970
|
std::time_t rawTime = std::time(nullptr); // Get current UTC time
|
||||||
milliseconds ms = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
auto localTime = std::localtime(&rawTime); // Convert to local time
|
||||||
// ms between Jan 1 1900 and Jan 1 1970 (2208988800 seconds elapsed between the two)
|
|
||||||
constexpr u64 offset = 2208988800ull * 1000;
|
bool daylightSavings = localTime->tm_isdst > 0; // Get if time includes DST
|
||||||
return ms.count() + offset;
|
localTime = std::gmtime(&rawTime);
|
||||||
|
|
||||||
|
// Use gmtime + mktime to calculate difference between local time and UTC
|
||||||
|
auto timezoneDifference = rawTime - std::mktime(localTime);
|
||||||
|
if (daylightSavings) {
|
||||||
|
timezoneDifference += 60ull * 60ull; // Add 1 hour (60 seconds * 60 minutes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// seconds between Jan 1 1900 and Jan 1 1970
|
||||||
|
constexpr u64 offset = 2208988800ull;
|
||||||
|
milliseconds ms = duration_cast<milliseconds>(seconds(rawTime + timezoneDifference + offset));
|
||||||
|
return ms.count();
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue