-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #759 from Br-ian/758-save-game-sorting
systemTimeUTC-based save game sorting
- Loading branch information
Showing
9 changed files
with
102 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
Function: misc_fnc_numberToStringZeroPad | ||
Pads an integer with zeros until a certain length is reached. | ||
Parameters: _number, _padding | ||
_number - the number that is to be padded | ||
_padding - the maximum amount of padding | ||
Returns: zero padded string | ||
Example: | ||
[123, 4] call misc_fnc_numberToStringZeroPad; | ||
Return value: "0123" | ||
*/ | ||
|
||
params ["_number", "_padding"]; | ||
|
||
private _numStr = str (floor _number); | ||
private _length = count _numStr; | ||
|
||
if (_length < _padding) then { | ||
private _paddedNumStr = _numStr; | ||
for [{private _i = 0}, {_i < _padding - _length}, {_i = _i + 1}] do { | ||
_paddedNumStr = "0" + _paddedNumStr; | ||
}; | ||
_paddedNumStr | ||
} else { | ||
_numStr | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Function: misc_fnc_systemTimeToISO8601 | ||
Converts a date into an ISO8601 string representation of the date. | ||
Arguments: date in format returned by systemTime or systemTimeUTC SQF command | ||
Returns: string | ||
Example: | ||
[2020, 11, 23, 13, 37, 42, 123] call misc_fnc_systemTimeToISO8601; | ||
Return value: "2020-11-23T13:37:42.123" | ||
*/ | ||
|
||
_date = _this; | ||
private _year4 = [_date#0, 4] call misc_fnc_numberToStringZeroPad; | ||
private _ms = [_date#6, 3] call misc_fnc_numberToStringZeroPad; // Zero-pad numbers below 100 | ||
_date = _date apply { [_x, 2] call misc_fnc_numberToStringZeroPad }; // Zero-pad numbers below 10 | ||
_date params ["_year", "_month", "_day", "_h", "_m", "_s"]; | ||
format ["%1-%2-%3T%4:%5:%6.%7", _year4, _month, _day, _h, _m, _s, _ms] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
30 | ||
31 |