From 8db76187b059678db3fed24050ff8989a9a537b5 Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Thu, 9 May 2024 03:56:29 -0400 Subject: [PATCH 1/6] add revision info --- src/DMAPI/tgs/v3210/api.dm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/DMAPI/tgs/v3210/api.dm b/src/DMAPI/tgs/v3210/api.dm index 666201a322..98da01356f 100644 --- a/src/DMAPI/tgs/v3210/api.dm +++ b/src/DMAPI/tgs/v3210/api.dm @@ -36,6 +36,7 @@ var/instance_name var/originmastercommit var/commit + var/revision_date var/list/cached_custom_tgs_chat_commands var/warned_revison = FALSE var/warned_custom_commands = FALSE @@ -76,6 +77,13 @@ logs = splittext(logs[logs.len], " ") if (logs.len >= 2) originmastercommit = logs[2] + if(logs.len >= 5) + revision_date_epoch = text2num(logs[5]) + if(isnum(revision_date_epoch)) + revision_date = unix_epoch_to_iso_timestamp(revision_date_epoch) + else + revision_date = "" + TGS_ERROR_LOG("Error parsing origin commmit logs") else TGS_ERROR_LOG("Error parsing origin commmit logs") @@ -184,6 +192,7 @@ var/datum/tgs_revision_information/ri = new ri.commit = commit ri.origin_commit = originmastercommit + ri.timestamp = revision_date return ri /datum/tgs_api/v3210/EndProcess() @@ -211,6 +220,13 @@ /datum/tgs_api/v3210/SecurityLevel() return TGS_SECURITY_TRUSTED +/datum/tgs_api/v3210/proc/unix_epoch_to_iso_timestamp(epoch) + epoch += world.timezone * 3600 // adjust for timezone + epoch -= 946684800 // adjust for unix to byond epoch lapse (30 years) + epoch *= 10 // adjust for time2text expecting decisonds + // third paramter is timezone, which only works for versions 514+. but we can put a 0 here and itll be the same for old versions + return time2text(epoch, "YYYY-MM-DDThh:mm:ss", 0) + #undef REBOOT_MODE_NORMAL #undef REBOOT_MODE_HARD #undef REBOOT_MODE_SHUTDOWN From b6ccc3ccc2cbe1d5c618a8b06207ee30f714a6aa Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Thu, 9 May 2024 03:57:50 -0400 Subject: [PATCH 2/6] helpful error message --- src/DMAPI/tgs/v3210/api.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DMAPI/tgs/v3210/api.dm b/src/DMAPI/tgs/v3210/api.dm index 98da01356f..ecfbcfacc0 100644 --- a/src/DMAPI/tgs/v3210/api.dm +++ b/src/DMAPI/tgs/v3210/api.dm @@ -83,7 +83,10 @@ revision_date = unix_epoch_to_iso_timestamp(revision_date_epoch) else revision_date = "" - TGS_ERROR_LOG("Error parsing origin commmit logs") + TGS_ERROR_LOG("Error parsing origin commit timestamp as number") + else + revision_date = "" + TGS_ERROR_LOG("Error parsing origin commmit timestamp at all") else TGS_ERROR_LOG("Error parsing origin commmit logs") From 6acfc14480a4ab573e170ff4565c15d60192b77c Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Thu, 9 May 2024 04:01:20 -0400 Subject: [PATCH 3/6] need var/ here --- src/DMAPI/tgs/v3210/api.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DMAPI/tgs/v3210/api.dm b/src/DMAPI/tgs/v3210/api.dm index ecfbcfacc0..564296f6f8 100644 --- a/src/DMAPI/tgs/v3210/api.dm +++ b/src/DMAPI/tgs/v3210/api.dm @@ -78,7 +78,7 @@ if (logs.len >= 2) originmastercommit = logs[2] if(logs.len >= 5) - revision_date_epoch = text2num(logs[5]) + var/revision_date_epoch = text2num(logs[5]) if(isnum(revision_date_epoch)) revision_date = unix_epoch_to_iso_timestamp(revision_date_epoch) else From f11c593e5b893a424d1d9ad1136c01069b7e3b4b Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Thu, 9 May 2024 16:13:23 -0400 Subject: [PATCH 4/6] world.timezone doesnt even exist pre 514 --- build/Version.props | 2 +- src/DMAPI/tgs.dm | 2 +- src/DMAPI/tgs/v3210/api.dm | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build/Version.props b/build/Version.props index ee18efd0fa..4f6f0fe8ac 100644 --- a/build/Version.props +++ b/build/Version.props @@ -9,7 +9,7 @@ 7.0.0 13.0.1 15.0.1 - 7.0.2 + 7.0.3 5.8.0 1.4.1 1.2.1 diff --git a/src/DMAPI/tgs.dm b/src/DMAPI/tgs.dm index fdfec5e8ca..afc51435b9 100644 --- a/src/DMAPI/tgs.dm +++ b/src/DMAPI/tgs.dm @@ -1,6 +1,6 @@ // tgstation-server DMAPI -#define TGS_DMAPI_VERSION "7.0.2" +#define TGS_DMAPI_VERSION "7.0.3" // All functions and datums outside this document are subject to change with any version and should not be relied on. diff --git a/src/DMAPI/tgs/v3210/api.dm b/src/DMAPI/tgs/v3210/api.dm index 564296f6f8..6e4e56ac48 100644 --- a/src/DMAPI/tgs/v3210/api.dm +++ b/src/DMAPI/tgs/v3210/api.dm @@ -77,6 +77,7 @@ logs = splittext(logs[logs.len], " ") if (logs.len >= 2) originmastercommit = logs[2] +#if DM_VERSION >= 514 if(logs.len >= 5) var/revision_date_epoch = text2num(logs[5]) if(isnum(revision_date_epoch)) @@ -87,6 +88,10 @@ else revision_date = "" TGS_ERROR_LOG("Error parsing origin commmit timestamp at all") +#else + revision_date = "" + TGS_WARNING_LOG("Revision date parsing is not support on versions below 514") +#endif else TGS_ERROR_LOG("Error parsing origin commmit logs") From 6c0e026d43c900032293b20823f0a8fd27b6a6fd Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Thu, 9 May 2024 16:43:06 -0400 Subject: [PATCH 5/6] a --- src/DMAPI/tgs/v3210/api.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DMAPI/tgs/v3210/api.dm b/src/DMAPI/tgs/v3210/api.dm index 6e4e56ac48..125d85b0df 100644 --- a/src/DMAPI/tgs/v3210/api.dm +++ b/src/DMAPI/tgs/v3210/api.dm @@ -228,12 +228,14 @@ /datum/tgs_api/v3210/SecurityLevel() return TGS_SECURITY_TRUSTED +#if DM_VERSION >= 514 /datum/tgs_api/v3210/proc/unix_epoch_to_iso_timestamp(epoch) epoch += world.timezone * 3600 // adjust for timezone epoch -= 946684800 // adjust for unix to byond epoch lapse (30 years) epoch *= 10 // adjust for time2text expecting decisonds // third paramter is timezone, which only works for versions 514+. but we can put a 0 here and itll be the same for old versions return time2text(epoch, "YYYY-MM-DDThh:mm:ss", 0) +#endif #undef REBOOT_MODE_NORMAL #undef REBOOT_MODE_HARD From 73ed6e6824bb63fd6c63f72bd798908718af5096 Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Thu, 9 May 2024 16:43:06 -0400 Subject: [PATCH 6/6] a --- src/DMAPI/tgs/v3210/api.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DMAPI/tgs/v3210/api.dm b/src/DMAPI/tgs/v3210/api.dm index 6e4e56ac48..32dd93d2c0 100644 --- a/src/DMAPI/tgs/v3210/api.dm +++ b/src/DMAPI/tgs/v3210/api.dm @@ -228,12 +228,13 @@ /datum/tgs_api/v3210/SecurityLevel() return TGS_SECURITY_TRUSTED +#if DM_VERSION >= 514 /datum/tgs_api/v3210/proc/unix_epoch_to_iso_timestamp(epoch) epoch += world.timezone * 3600 // adjust for timezone epoch -= 946684800 // adjust for unix to byond epoch lapse (30 years) epoch *= 10 // adjust for time2text expecting decisonds - // third paramter is timezone, which only works for versions 514+. but we can put a 0 here and itll be the same for old versions return time2text(epoch, "YYYY-MM-DDThh:mm:ss", 0) +#endif #undef REBOOT_MODE_NORMAL #undef REBOOT_MODE_HARD