MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / GetTruncatedJDN

Function GetTruncatedJDN

Sources/Shared/Containers/DateTime.cpp:70–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 static std::int32_t GetTruncatedJDN(std::int32_t day, std::int32_t mon, std::int32_t year) noexcept
71 {
72 // Make the year positive to avoid problems with negative numbers division
73 year += 4800;
74
75 // Months are counted from March here
76 std::int32_t month;
77 if (mon >= 2 /*March*/) {
78 month = mon - 2;
79 } else {
80 month = mon + 10;
81 year--;
82 }
83
84 return ((year / 100) * DAYS_PER_400_YEARS) / 4 + ((year % 100) * DAYS_PER_4_YEARS) / 4
85 + (month * DAYS_PER_5_MONTHS + 2) / 5 + day - JDN_OFFSET;
86 }
87
88 static struct tm* GetLocalTm(const time_t* ticks, struct tm* temp) noexcept
89 {

Callers 2

ComputeWeekDayMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected