Markers - Add the option for UTC/System time timestamps (#9121)

* Markers - Add setting for system timestamps

* Moved time zone to different setting
Added UTC Time zone
Added UTC time offset slider
Added translation in stringtable

* Update fnc_onButtonClickConfirm.sqf

Fixed mistake that added offset twice

* - Removed tabs
- Fixed calculating error

* - Fixed tab problem

Was a bit enthusiastic with removing tabs. This should to the trick.

* - Changed tabs to spaces (Finaly)
- Checked SQF with sqf_validator.py
- Fixed decimal error by CBA menu

* Delete build/_deps directory

- This does not belong here

* Update fnc_onButtonClickConfirm.sqf

Added empty line back

* Update addons/markers/functions/fnc_onButtonClickConfirm.sqf

Formatting update

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

* Update addons/markers/functions/fnc_onButtonClickConfirm.sqf

Formatting update

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

* Update initSettings.sqf

Added newline at end of file

* Update fnc_onButtonClickConfirm.sqf

Fixed fnc header formatting

* Update addons/markers/functions/fnc_onButtonClickConfirm.sqf

Formatting

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>

* Update fnc_onButtonClickConfirm.sqf

Updated formatting

* Implemented review changes

* Review suggestion

* Bugfix return absolute positive number with modulo

* Updated script to allow offset to exeed midnight in the past

* Updated script to allow offset to exeed midnight in the past

* Updated script to allow offset to exeed midnight in the past

* Updated hour offset calculation

* Add support for UTC+13 and +14 timezone

* Add minutes UTC offset to timestamp

* Add UTC minutes offset setting

* Add translation for UTC minute offset setting

* Prevent timestamp going over 24 after adding minutes offset

* Modify english description for offset settings

* Update addons/markers/initSettings.sqf

* Properly handle minute offset with negative timezone

* Implemented better solution to handle negative timestamp seconds offset

* reverted 'Implemented better solution to handle negative timestamp seconds offset'

* Revert "Implemented better solution to handle negative timestamp seconds offset"

This reverts commit d2599bd9aa.

* Update timestamp calculation comments

* Update timestamp calculation comments

* Update documentation in UTC timestamp calculation

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
Daniël 2024-01-07 19:06:35 +01:00 committed by GitHub
parent 79c43179ea
commit 1563eb9336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 154 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: Freddo
* Author: Freddo, Daniël H.
* When the confirm button is pressed.
*
* Arguments:
@ -17,12 +17,33 @@
params ["_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;
// handle timestamp
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
private _time = daytime;
// determine marker timestamp based on time settings
private _time = switch (GVAR(timestampTimezone)) do {
case 1: {
systemTime params ["", "", "", "_hour", "_min", "_sec"];
_hour + _min/60 + _sec/3600
};
case 2: {
systemTimeUTC params ["", "", "", "_hour", "_min", "_sec"];
_hourOffset = round (GVAR(timestampUTCOffset));
_hour = _hour + _hourOffset;
// add or subtract minutes offset based on the negative or positive timezone
_min = if (_hourOffset < 0) then { _min - GVAR(timestampUTCMinutesOffset) } else { _min + GVAR(timestampUTCMinutesOffset) };
// prevent the timestamp from exceeding 24 hours or going below 0 hours
_time = ((_hour + _min/60 + _sec/3600) % 24 + 24) % 24;
_time
};
default {
dayTime
};
};
// add timestamp suffix
private _periodPostfix = "";

View File

@ -32,6 +32,37 @@ private _categoryName = format ["ACE %1", localize ELSTRING(map,Module_DisplayNa
true
] call CBA_fnc_addSetting;
[
QGVAR(timestampTimezone), "LIST",
[LSTRING(TimestampTimezone), LSTRING(TimestampTimezoneDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[0, 1, 2],
[LSTRING(TimestampTimezoneIngameTime), LSTRING(TimestampTimezoneSystemTime), LSTRING(TimestampTimezoneUTCTime)],
0
],
true
] call CBA_fnc_addSetting;
[
QGVAR(timestampUTCOffset), "SLIDER",
[LSTRING(TimestampUTCOffset), LSTRING(TimestampUTCOffsetDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[-12, 14, 0, 0],
true
] call CBA_fnc_addSetting;
[
QGVAR(TimestampUTCMinutesOffset), "LIST",
[LSTRING(TimestampUTCMinutesOffset), LSTRING(TimestampUTCMinutesOffsetDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[0, 15, 30, 45],
[0, 15, 30, 45],
0
]
] call CBA_fnc_addSetting;
[
QGVAR(timestampHourFormat), "LIST",
[LSTRING(TimestampHourFormat), LSTRING(TimestampHourFormatDescription)],

View File

@ -239,6 +239,105 @@
<Korean>시계 필요함</Korean>
<Portuguese>Relógio necessário</Portuguese>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezone">
<English>Time Zone</English>
<Russian>Часовой пояс</Russian>
<French>Fuseau horaire</French>
<Japanese>時間帯</Japanese>
<Spanish>Zona horaria</Spanish>
<Polish>Strefa czasowa</Polish>
<German>Zeitzone</German>
<Chinesesimp>时区</Chinesesimp>
<Korean>시간대</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneDescription">
<English>Changes the time zone for the timestamp</English>
<Russian>Измените часовой пояс для метки времени</Russian>
<French>Modifiez le fuseau horaire pour l'horodatage</French>
<Japanese>タイムスタンプの時間帯を変更します</Japanese>
<Spanish>Cambie la zona horaria para la marca de tiempo</Spanish>
<Polish>Zmień strefę czasową dla znaczników czasu</Polish>
<German>Ändern Sie die Zeitzone für den Zeitstempel</German>
<Chinesesimp>更改时间戳的时区</Chinesesimp>
<Korean>타임스탬프의 시간대를 변경하십시오</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneIngameTime">
<English>In-game Time</English>
<Russian>Время в игре</Russian>
<French>Heure de jeu</French>
<Japanese>ゲーム内時刻</Japanese>
<Spanish>Hora del juego</Spanish>
<Polish>Czas gry</Polish>
<German>Ingame-Zeit</German>
<Chinesesimp>游戏内时间</Chinesesimp>
<Korean>게임 시간</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneSystemTime">
<English>System Time</English>
<Russian>Системное время</Russian>
<French>Heure système</French>
<Japanese>システム時刻</Japanese>
<Spanish>Hora del sistema</Spanish>
<Polish>Czas systemowy</Polish>
<German>Systemzeit</German>
<Chinesesimp>系统时间</Chinesesimp>
<Korean>시스템 시간</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneUTCTime">
<English>UTC Time</English>
<Russian>Время UTC</Russian>
<French>Heure UTC</French>
<Japanese>UTC時刻</Japanese>
<Spanish>Hora UTC</Spanish>
<Polish>Czas UTC</Polish>
<German>UTC-Zeit</German>
<Chinesesimp>UTC时间</Chinesesimp>
<Korean>UTC 시간</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampUTCOffset">
<English>UTC Offset</English>
<Russian>Смещение UTC</Russian>
<French>Décalage UTC</French>
<Japanese>UTCオフセット</Japanese>
<Spanish>Desplazamiento UTC</Spanish>
<Polish>Przesunięcie UTC</Polish>
<German>UTC-Verschiebung</German>
<Chinesesimp>UTC偏移量</Chinesesimp>
<Korean>UTC 오프셋</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampUTCOffsetDescription">
<English>Changes the time offset for the UTC timestamp</English>
<Russian>Измените смещение времени для метки времени UTC</Russian>
<French>Modifier le décalage horaire pour l'horodatage UTC</French>
<Japanese>UTCタイムスタンプの時差を変更する</Japanese>
<Spanish>Cambiar el desplazamiento horario para la marca de tiempo UTC</Spanish>
<Polish>Zmień przesunięcie czasu dla sygnatury czasowej UTC</Polish>
<German>Ändere die Zeitverschiebung für den UTC-Zeitstempel</German>
<Chinesesimp>更改UTC时间戳的时间偏移量</Chinesesimp>
<Korean>UTC 타임 스탬프의 시간 오프셋을 변경하십시오</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampUTCMinutesOffset">
<English>UTC Minutes Offset</English>
<Russian>UTC Минутное Смещение</Russian>
<French>Décalage des minutes UTC</French>
<Japanese>UTC分オフセット</Japanese>
<Spanish>Desplazamiento de minutos UTC</Spanish>
<Polish>Przesunięcie minut UTC</Polish>
<German>UTC-Minutenversatz</German>
<Chinesesimp>UTC分钟偏移量</Chinesesimp>
<Korean>UTC 분 오프셋</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampUTCMinutesOffsetDescription">
<English>Change the minute offset for the UTC timestamp</English>
<Russian>Изменить минутное смещение для времени UTC</Russian>
<French>Modifier le décalage des minutes pour l'horodatage UTC</French>
<Japanese>UTCタイムスタンプの分差を変更する</Japanese>
<Spanish>Cambiar el desplazamiento de minutos para la marca de tiempo UTC</Spanish>
<Polish>Zmień przesunięcie minut dla sygnatury czasowej UTC</Polish>
<German>Ändere den Minutenversatz für den UTC-Zeitstempel</German>
<Chinesesimp>更改UTC时间戳的分钟偏移量</Chinesesimp>
<Korean>UTC 타임 스탬프의 분 오프셋을 변경하십시오</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampFormat">
<English>Timestamp Format</English>
<Russian>Формат времени</Russian>