#pragma once #include #include #include #include #include #include "day_of_week.h" #include "configuration.h" #include "time_range.h" using namespace std; class Utilities { public: /// /// Get day of week from current date (Zeller's Algorithm), starting day is Sunday /// /// /// static DayOfWeek GetDayOfWeek(struct tm* tm); /// /// Date and time parse helper function /// /// Returns time (tm) structure static struct tm DateTimeToStructTm(const char* dateTimeStr); /// /// Date parse helper function /// /// Returns time (tm) structure static struct tm DateToStructTm(const char* dateStr); /// /// Time parse helper function /// /// Returns time (tm) structure static struct tm TimeToStructTm(const char* timeStr, int year, int mon, int mday, int wday); /// /// Get current local time /// /// Returns time_t structure static time_t GetCurrentLocalTime(); /// /// Zeller's algorithm for determining day of week /// static int ZellersAlgorithm(int day, int month, int year); /// /// Checks if current datetime is in range between start and end month of parking worktime /// /// /// /// static bool IsYearPeriodActive(Configuration* cfg, struct tm* currentDateTime); /// /// Check permissions /// static bool CheckSpecialDay(Configuration* cfg, const char* currentDateTimeStr, int* specialDayId, double* specialDayPrice); /// /// Calculates price per unit /// /// /// static double CalculatePricePerUnit(double pra_price, double durationUnit = -1); };