From 01957bd173fbf3ba6a504724fe456ff92f64688e Mon Sep 17 00:00:00 2001 From: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Date: Tue, 27 Jun 2023 22:27:19 -0400 Subject: [PATCH] Add check for illegally formatted unix timestamp for logging (#76193) This runtiming is bad --- code/modules/logging/log_holder.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/modules/logging/log_holder.dm b/code/modules/logging/log_holder.dm index 76b0683b9b8..7d8386e77b6 100644 --- a/code/modules/logging/log_holder.dm +++ b/code/modules/logging/log_holder.dm @@ -249,7 +249,13 @@ GENERAL_PROTECT_DATUM(/datum/log_holder) /datum/log_holder/proc/human_readable_timestamp(precision = 3) var/start = time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss") // now we grab the millis from the rustg timestamp - var/list/timestamp = splittext(unix_timestamp_string(), ".") + var/rustg_stamp = unix_timestamp_string() + var/list/timestamp = splittext(rustg_stamp, ".") +#ifdef UNIT_TESTS + if(length(timestamp) != 2) + stack_trace("rustg returned illegally formatted string '[rustg_stamp]'") + return start +#endif var/millis = timestamp[2] if(length(millis) > precision) millis = copytext(millis, 1, precision + 1)