Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CBA_fnc_weekDay #75

Merged
merged 1 commit into from
May 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions template/admin/initServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,9 @@

#define MISSION_TYPES ["Contract", "Non-Contract", "Training", "Special", "PvP", "Gimmick"]

// Get weekday for start times
FUNC(weekDay) = { // Replace with CBA_fnc_weekDay when released
params ["_date"];

// Keep only year, month, day if longer date format is given
_date = [_date select 0, _date select 1, _date select 2, 0, 0];

private _yearBefore = ((_date select 0) - 1) max 0;
private _leapYears = floor (_yearBefore / 4);
private _normalYears = _yearBefore - _leapYears;
private _days = _normalYears + (_leapYears * (366 / 365)) + dateToNumber _date;

(round (_days / (1 / 365))) mod 7 // return
};

// Mathematical Heresy
systemTimeUTC params ["", "", "", "_hour", "_minute"];
private _weekDay = [systemTimeUTC] call FUNC(weekDay);
private _weekDay = [systemTimeUTC] call CBA_fnc_weekDay;
private _startTime = [15, 14] select (_weekDay == 6); // 1400z on Saturday, 1500z otherwise
private _timeUntilStart = ((_startTime * 60) - (_hour * 60 + _minute)) * 60; // start time - current time = time until start time
_timeUntilStart = _timeUntilStart max 0;
Expand Down