From 013d9069d3b92a482d7eb2bca37d44b8be22fd17 Mon Sep 17 00:00:00 2001 From: khumnath Date: Mon, 17 Jun 2024 21:55:58 +0900 Subject: [PATCH] fix errors from windows build --- bikram.h | 14 +++++++++++--- calendarwindow.ui | 13 +++++++++++-- mainwindow.cpp | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) mode change 100644 => 100755 bikram.h mode change 100644 => 100755 calendarwindow.ui mode change 100644 => 100755 mainwindow.cpp diff --git a/bikram.h b/bikram.h old mode 100644 new mode 100755 index d577a55..c0d2d39 --- a/bikram.h +++ b/bikram.h @@ -1,7 +1,7 @@ #ifndef BIKRAM_H #define BIKRAM_H -#include +#include #include #include #include @@ -152,8 +152,16 @@ inline void bikram::fromNepali(int bsYear, int bsMonth, int bsDay) { } inline int bikram::getDayOfWeek() { - std::tm timeinfo = { 0, 0, 0, Day, Month - 1, Year - 1900, 0, 0, 0, 0, "" }; + std::tm timeinfo; + std::memset(&timeinfo, 0, sizeof(timeinfo)); // Initialize all members to zero + + timeinfo.tm_mday = Day; + timeinfo.tm_mon = Month - 1; + timeinfo.tm_year = Year - 1900; + + // Call std::mktime to normalize the tm structure std::mktime(&timeinfo); + return timeinfo.tm_wday; } @@ -171,7 +179,7 @@ inline int bikram::getDay() { inline std::string bikram::getWeekdayName(int year, int month, int day) { - std::tm timeinfo = { 0, 0, 0, day, month - 1, year - 1900, 0, 0, 0, 0, "" }; + std::tm timeinfo = { 0, 0, 0, 0, day, month - 1, year - 1900, 0, 0, 0, 0 }; std::mktime(&timeinfo); const char* weekday[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; return weekday[timeinfo.tm_wday]; diff --git a/calendarwindow.ui b/calendarwindow.ui old mode 100644 new mode 100755 index 99a0a5e..d3162fe --- a/calendarwindow.ui +++ b/calendarwindow.ui @@ -101,7 +101,7 @@ 90 50 111 - 40 + 41 @@ -112,6 +112,9 @@ + + 12 + @@ -155,7 +158,7 @@ 390 50 101 - 40 + 41 @@ -166,6 +169,12 @@ + + 12 + + + 0 + diff --git a/mainwindow.cpp b/mainwindow.cpp old mode 100644 new mode 100755 index f166e35..e8aca32 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,7 +13,7 @@ #include std::string MainWindow::getWeekdayName(int year, int month, int day) { - std::tm timeinfo = { 0, 0, 0, day, month - 1, year - 1900, 0, 0, 0, 0, "" }; + std::tm timeinfo = { 0, 0, 0, 0, day, month - 1, year - 1900, 0, 0, 0, 0}; std::mktime(&timeinfo); // Update timeinfo to fill in the week day field const std::string nepaliWeekdays[] = { "आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार" };