3 Commits
3 changed files with 667 additions and 154 deletions

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ elseif ($msBuild -match "\\18\\") { $vsYear = "2019 Insiders" }
Write-Host "Using MSBuild: $msBuild" -ForegroundColor Cyan Write-Host "Using MSBuild: $msBuild" -ForegroundColor Cyan
$rootDir = $PSScriptRoot $rootDir = $PSScriptRoot
$slnFile = Join-Path $rootDir "2019Remote.sln" $slnFile = Join-Path $rootDir "YAMA.sln"
$upxPath = Join-Path $rootDir "server\2015Remote\res\3rd\upx.exe" $upxPath = Join-Path $rootDir "server\2015Remote\res\3rd\upx.exe"
# Publish mode overrides # Publish mode overrides
File diff suppressed because it is too large. Load diff
+11 -7
View File
@@ -13,6 +13,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
#include <cstdlib>
#include <map> #include <map>
#include <chrono> #include <chrono>
#include <cmath> #include <cmath>
@@ -88,16 +89,19 @@ private:
int daysBetweenDates(const tm& date1, const tm& date2) int daysBetweenDates(const tm& date1, const tm& date2)
{ {
auto timeToTimePoint = [](const tm& tmTime) { // Use Julian Day Number to avoid DST issues
std::time_t tt = mktime(const_cast<tm*>(&tmTime)); // Formula: https://en.wikipedia.org/wiki/Julian_day
return std::chrono::system_clock::from_time_t(tt); auto toJulianDay = [](int year, int month, int day) {
int a = (14 - month) / 12;
int y = year + 4800 - a;
int m = month + 12 * a - 3;
return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045;
}; };
auto tp1 = timeToTimePoint(date1); int jd1 = toJulianDay(date1.tm_year + 1900, date1.tm_mon + 1, date1.tm_mday);
auto tp2 = timeToTimePoint(date2); int jd2 = toJulianDay(date2.tm_year + 1900, date2.tm_mon + 1, date2.tm_mday);
auto duration = tp1 > tp2 ? tp1 - tp2 : tp2 - tp1; return std::abs(jd1 - jd2);
return static_cast<int>(std::chrono::duration_cast<std::chrono::hours>(duration).count() / 24);
} }
tm getCurrentDate() tm getCurrentDate()