feat: add system time offset setting (#6139)

* Add setting for system time offset

Add a setting to displace citra system time by days, hours, minutes
or seconds
Add UI for the setting which is only visible when clock is set to
system time
Change core/settings.h to include the setting

* Add system time offset to kernel

Actually makes use of the time offset.

* Fix time offset calculatioon in core/movie.cpp

* Replace C++20 chrono::days with seconds

Hopefully fixes the build.
This commit is contained in:
DaemonTsun 2022-11-20 16:34:53 +01:00 committed by GitHub
parent 3b6ffd9c27
commit 64062162c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 138 additions and 11 deletions

View file

@ -601,9 +601,17 @@ void Movie::PrepareForPlayback(const std::string& movie_file) {
}
void Movie::PrepareForRecording() {
init_time = (Settings::values.init_clock == Settings::InitClock::SystemTime
? Common::Timer::GetTimeSinceJan1970().count()
: Settings::values.init_time);
if (Settings::values.init_clock == Settings::InitClock::SystemTime) {
long long init_time_offset = Settings::values.init_time_offset;
long long days_offset = init_time_offset / 86400;
unsigned long long seconds_offset =
std::abs(init_time_offset) - std::abs(days_offset * 86400);
init_time =
Common::Timer::GetTimeSinceJan1970().count() + seconds_offset + (days_offset * 86400);
} else {
init_time = Settings::values.init_time;
}
}
Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file) const {