Add getter for calendar sub date fract

This commit is contained in:
Jonathan G Rennison 2024-02-20 18:18:54 +00:00
parent f32eef4f38
commit 24cd52616c
3 changed files with 4 additions and 3 deletions

View File

@ -575,7 +575,7 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last)
buffer += UTCTime::Format(buffer, last, "Crash at: %Y-%m-%d %H:%M:%S (UTC)\n"); buffer += UTCTime::Format(buffer, last, "Crash at: %Y-%m-%d %H:%M:%S (UTC)\n");
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u)\n", EconTime::CurYear().base(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract(), TickSkipCounter(), DayLengthFactor()); buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u)\n", EconTime::CurYear().base(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract(), TickSkipCounter(), DayLengthFactor());
buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::Detail::now.sub_date_fract); buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::CurSubDateFract());
LogGameLoadDateTimes(buffer, last); LogGameLoadDateTimes(buffer, last);
return buffer; return buffer;
}); });
@ -675,7 +675,7 @@ static char *LogDesyncDateHeader(char *buffer, const char *last)
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u), %08X\n", buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u), %08X\n",
EconTime::CurYear().base(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract(), TickSkipCounter(), DayLengthFactor(), _frame_counter); EconTime::CurYear().base(), EconTime::CurMonth() + 1, EconTime::CurDay(), EconTime::CurDateFract(), TickSkipCounter(), DayLengthFactor(), _frame_counter);
buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::Detail::now.sub_date_fract); buffer += seprintf(buffer, last, "Calendar date: %i-%02i-%02i (%i, %i)\n", CalTime::CurYear().base(), CalTime::CurMonth() + 1, CalTime::CurDay(), CalTime::CurDateFract(), CalTime::CurSubDateFract());
LogGameLoadDateTimes(buffer, last); LogGameLoadDateTimes(buffer, last);
if (_networking && !_network_server) { if (_networking && !_network_server) {
extern EconTime::Date _last_sync_date; extern EconTime::Date _last_sync_date;

View File

@ -186,6 +186,7 @@ struct CalTime : public DateDetail::BaseTime<struct CalendarTimeTag> {
static inline Day CurDay() { return Detail::now.cal_ymd.day; } static inline Day CurDay() { return Detail::now.cal_ymd.day; }
static inline Date CurDate() { return Detail::now.cal_date; } static inline Date CurDate() { return Detail::now.cal_date; }
static inline DateFract CurDateFract() { return Detail::now.cal_date_fract; } static inline DateFract CurDateFract() { return Detail::now.cal_date_fract; }
static inline uint16_t CurSubDateFract() { return Detail::now.sub_date_fract; }
static YearMonthDay ConvertDateToYMD(Date date); static YearMonthDay ConvertDateToYMD(Date date);
static Date ConvertYMDToDate(Year year, Month month, Day day); static Date ConvertYMDToDate(Year year, Month month, Day day);

View File

@ -1568,7 +1568,7 @@ void CallVehicleTicks()
if (TickSkipCounter() == 0) RunVehicleDayProc(); if (TickSkipCounter() == 0) RunVehicleDayProc();
if (EconTime::UsingWallclockUnits() && !CalTime::IsCalendarFrozen() && CalTime::Detail::now.sub_date_fract == 0) { if (EconTime::UsingWallclockUnits() && !CalTime::IsCalendarFrozen() && CalTime::CurSubDateFract() == 0) {
RunVehicleCalendarDayProc(); RunVehicleCalendarDayProc();
} }