mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Markers - Add true milliseconds as a timestamp option (#9690)
* Added real milliseconds to marker timestamp options * Fixed tabs * portuguese translation * Update fnc_onButtonClickConfirm.sqf --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
parent
1563eb9336
commit
474ecdd93b
@ -1,6 +1,6 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Freddo, Daniël H.
|
* Author: Freddo, Daniël H., johnb43
|
||||||
* When the confirm button is pressed.
|
* When the confirm button is pressed.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -14,61 +14,100 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_buttonOk"];
|
params ["_buttonOk"];
|
||||||
|
|
||||||
private _display = ctrlParent _buttonOk;
|
private _display = ctrlParent _buttonOk;
|
||||||
private _description = _display displayCtrl IDC_INSERT_MARKER;
|
private _description = _display displayCtrl IDC_INSERT_MARKER;
|
||||||
private _aceTimestamp = _display displayCtrl IDC_ACE_INSERT_MARKER_TIMESTAMP;
|
private _aceTimestamp = _display displayCtrl IDC_ACE_INSERT_MARKER_TIMESTAMP;
|
||||||
|
|
||||||
// handle timestamp
|
// Handle timestamp
|
||||||
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
|
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
|
||||||
// determine marker timestamp based on time settings
|
// Determine marker timestamp based on time settings
|
||||||
private _time = switch (GVAR(timestampTimezone)) do {
|
private _time = switch (GVAR(timestampTimezone)) do {
|
||||||
case 1: {
|
case 1: {
|
||||||
systemTime params ["", "", "", "_hour", "_min", "_sec"];
|
systemTime select [3]
|
||||||
_hour + _min/60 + _sec/3600
|
|
||||||
};
|
};
|
||||||
case 2: {
|
case 2: {
|
||||||
systemTimeUTC params ["", "", "", "_hour", "_min", "_sec"];
|
systemTimeUTC params ["", "", "", "_hour", "_min", "_sec", "_msec"];
|
||||||
_hourOffset = round (GVAR(timestampUTCOffset));
|
|
||||||
|
private _hourOffset = round GVAR(timestampUTCOffset);
|
||||||
_hour = _hour + _hourOffset;
|
_hour = _hour + _hourOffset;
|
||||||
|
|
||||||
// add or subtract minutes offset based on the negative or positive timezone
|
// Add or subtract minutes offset based on the negative or positive timezone
|
||||||
_min = if (_hourOffset < 0) then { _min - GVAR(timestampUTCMinutesOffset) } else { _min + GVAR(timestampUTCMinutesOffset) };
|
if (GVAR(timestampUTCMinutesOffset) != 0) then {
|
||||||
|
_min = if (_hourOffset < 0) then { _min - GVAR(timestampUTCMinutesOffset) } else { _min + GVAR(timestampUTCMinutesOffset) };
|
||||||
|
|
||||||
// prevent the timestamp from exceeding 24 hours or going below 0 hours
|
// Add/remove extra hours from minutes
|
||||||
_time = ((_hour + _min/60 + _sec/3600) % 24 + 24) % 24;
|
_hour = _hour + floor (_min / 60);
|
||||||
_time
|
_min = (_min % 60 + 60) % 60; // ensure that minutes are between 0 and 59 (included)
|
||||||
|
};
|
||||||
|
|
||||||
|
[(_hour % 24 + 24) % 24, _min, _sec, _msec] // ensure that hours are between 0 and 23 (included)
|
||||||
};
|
};
|
||||||
default {
|
default {
|
||||||
dayTime
|
private _daytime = dayTime;
|
||||||
|
|
||||||
|
private _hour = floor _daytime;
|
||||||
|
private _min = floor ((_daytime - _hour) * 60);
|
||||||
|
private _sec = floor ((((_daytime - _hour) * 60) - _min) * 60);
|
||||||
|
private _msec = floor ((((((_daytime - _hour) * 60) - _min) * 60) - _sec) * 1000);
|
||||||
|
|
||||||
|
[_hour, _min, _sec, _msec]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// add timestamp suffix
|
_time params ["_hour", "_min", "_sec", "_msec"];
|
||||||
|
|
||||||
|
// Add timestamp suffix
|
||||||
private _periodPostfix = "";
|
private _periodPostfix = "";
|
||||||
|
|
||||||
if (GVAR(timestampHourFormat) == 12) then {
|
if (GVAR(timestampHourFormat) == 12) then {
|
||||||
if (floor _time == 0) exitWith {
|
if (_hour == 0) exitWith {
|
||||||
_time = _time + 12;
|
_hour = _hour + 12;
|
||||||
_periodPostfix = " am";
|
_periodPostfix = " am";
|
||||||
};
|
};
|
||||||
|
|
||||||
if (floor _time == 12) exitWith {
|
if (_hour == 12) exitWith {
|
||||||
_periodPostfix = " pm";
|
_periodPostfix = " pm";
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_time < 12) then {
|
if (_hour < 12) then {
|
||||||
_periodPostfix = " am";
|
_periodPostfix = " am";
|
||||||
} else {
|
} else {
|
||||||
_time = _time - 12;
|
_hour = _hour - 12;
|
||||||
_periodPostfix = " pm";
|
_periodPostfix = " pm";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _format = switch (GVAR(timestampFormat)) do {
|
||||||
|
case "HH": {"%1"};
|
||||||
|
case "HH:MM": {"%1:%2"};
|
||||||
|
case "HH:MM:SS": {"%1:%2:%3"};
|
||||||
|
case "HH:MM:SS:MM": { // milliseconds are displayed as 0 to 59
|
||||||
|
_msec = [_msec * 60 / 1000, 2] call CBA_fnc_formatNumber;
|
||||||
|
|
||||||
|
"%1:%2:%3:%4"
|
||||||
|
};
|
||||||
|
case "HH:MM:SS.mmm": { // milliseconds are displayed as 0 to 999
|
||||||
|
_msec = [_msec, 3] call CBA_fnc_formatNumber;
|
||||||
|
|
||||||
|
"%1:%2:%3.%4"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_time = format [
|
||||||
|
_format,
|
||||||
|
[_hour, 2] call CBA_fnc_formatNumber,
|
||||||
|
[_min, 2] call CBA_fnc_formatNumber,
|
||||||
|
[_sec, 2] call CBA_fnc_formatNumber,
|
||||||
|
_msec
|
||||||
|
];
|
||||||
|
|
||||||
_description ctrlSetText format [
|
_description ctrlSetText format [
|
||||||
"%1 [%2%3]",
|
"%1 [%2%3]",
|
||||||
ctrlText _description,
|
ctrlText _description,
|
||||||
[_time, GVAR(timestampFormat)] call BIS_fnc_timeToString,
|
_time,
|
||||||
_periodPostfix
|
_periodPostfix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -79,7 +79,8 @@ private _formatDescription = [
|
|||||||
LLSTRING(TimestampFormatDescription1),
|
LLSTRING(TimestampFormatDescription1),
|
||||||
LLSTRING(TimestampFormatDescription2),
|
LLSTRING(TimestampFormatDescription2),
|
||||||
LLSTRING(TimestampFormatDescription3),
|
LLSTRING(TimestampFormatDescription3),
|
||||||
LLSTRING(TimestampFormatDescription4)
|
LLSTRING(TimestampFormatDescription4),
|
||||||
|
LLSTRING(TimestampFormatDescription5)
|
||||||
] joinString endl;
|
] joinString endl;
|
||||||
|
|
||||||
[
|
[
|
||||||
@ -87,8 +88,8 @@ private _formatDescription = [
|
|||||||
[LSTRING(timestampFormat), _formatDescription],
|
[LSTRING(timestampFormat), _formatDescription],
|
||||||
[_categoryName, LLSTRING(Module_DisplayName)],
|
[_categoryName, LLSTRING(Module_DisplayName)],
|
||||||
[
|
[
|
||||||
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM"],
|
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM", "HH:MM:SS.mmm"],
|
||||||
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM"],
|
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM", "HH:MM:SS.mmm"],
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
@ -315,7 +315,7 @@
|
|||||||
<German>Ändere die Zeitverschiebung für den UTC-Zeitstempel</German>
|
<German>Ändere die Zeitverschiebung für den UTC-Zeitstempel</German>
|
||||||
<Chinesesimp>更改UTC时间戳的时间偏移量</Chinesesimp>
|
<Chinesesimp>更改UTC时间戳的时间偏移量</Chinesesimp>
|
||||||
<Korean>UTC 타임 스탬프의 시간 오프셋을 변경하십시오</Korean>
|
<Korean>UTC 타임 스탬프의 시간 오프셋을 변경하십시오</Korean>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Markers_TimestampUTCMinutesOffset">
|
<Key ID="STR_ACE_Markers_TimestampUTCMinutesOffset">
|
||||||
<English>UTC Minutes Offset</English>
|
<English>UTC Minutes Offset</English>
|
||||||
<Russian>UTC Минутное Смещение</Russian>
|
<Russian>UTC Минутное Смещение</Russian>
|
||||||
@ -404,17 +404,16 @@
|
|||||||
<Portuguese>SS - Segundos</Portuguese>
|
<Portuguese>SS - Segundos</Portuguese>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Markers_TimestampFormatDescription4">
|
<Key ID="STR_ACE_Markers_TimestampFormatDescription4">
|
||||||
<English>"MM" - Milliseconds</English>
|
<English>"MM" - Milliseconds (from 0 to 59)</English>
|
||||||
<Russian>"МС" - Миллисекунда</Russian>
|
<French>"MM" - Millisecondes (de 0 à 59)</French>
|
||||||
<French>"MM" - Millisecondes</French>
|
<German>"MS" - Milisekunden (von 0 bis 59)</German>
|
||||||
<Japanese>"MM" - ミリ秒</Japanese>
|
<Portuguese>"MS" - Milissegundos (de 0 a 59)</Portuguese>
|
||||||
<Spanish>"MM" - Milisegundos</Spanish>
|
</Key>
|
||||||
<Polish>"MM" - Milisekundy</Polish>
|
<Key ID="STR_ACE_Markers_TimestampFormatDescription5">
|
||||||
<German>"MS" - Milisekunden</German>
|
<English>"mmm" - Milliseconds (from 0 to 999)</English>
|
||||||
<Italian>"MS" - Millisecondi</Italian>
|
<French>"mmm" - Millisecondes (de 0 à 999)</French>
|
||||||
<Chinesesimp>"MS"—毫秒</Chinesesimp>
|
<German>"mmm" - Milisekunden (von 0 bis 999)</German>
|
||||||
<Korean>"MS" - 밀리초</Korean>
|
<Portuguese>"mmm" - Milissegundos (de 0 a 999)</Portuguese>
|
||||||
<Portuguese>MM - Milisegundos</Portuguese>
|
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Markers_TimestampHourFormat">
|
<Key ID="STR_ACE_Markers_TimestampHourFormat">
|
||||||
<English>Timestamp Hour Format</English>
|
<English>Timestamp Hour Format</English>
|
||||||
|
Loading…
Reference in New Issue
Block a user