update rust-g to 3.9.0 and use formatted_timestamp for human_readable_timestamp (#91121)

This commit is contained in:
Lucy
2025-05-15 16:13:56 -04:00
committed by Roxy
parent 847b7c86ef
commit 2d471c542e
4 changed files with 11 additions and 17 deletions
+8 -2
View File
@@ -363,8 +363,7 @@
#define rustg_time_reset(id) RUSTG_CALL(RUST_G, "time_reset")(id)
/// Returns the timestamp as a string
/proc/rustg_unix_timestamp()
return RUSTG_CALL(RUST_G, "unix_timestamp")()
#define rustg_unix_timestamp(...) (RUSTG_CALL(RUST_G, "unix_timestamp")())
#define rustg_raw_read_toml_file(path) json_decode(RUSTG_CALL(RUST_G, "toml_file_to_json")(path) || "null")
@@ -392,3 +391,10 @@
#define url_decode(text) rustg_url_decode(text)
#endif
/// Returns the current timestamp (in local time), formatted with the given format string.
/// See https://docs.rs/chrono/latest/chrono/format/strftime/index.html for documentation on the formatting syntax.
#define rustg_formatted_timestamp(format) RUSTG_CALL(RUST_G, "formatted_timestamp")(format)
/// Returns the current timestamp (with the given UTC offset in hours), formatted with the given format string.
/// See https://docs.rs/chrono/latest/chrono/format/strftime/index.html for documentation on the formatting syntax.
#define rustg_formatted_timestamp_tz(format, offset) RUSTG_CALL(RUST_G, "formatted_timestamp")(format, offset)
+2 -14
View File
@@ -275,20 +275,8 @@ ADMIN_VERB(log_viewer_new, R_ADMIN|R_DEBUG, "View Round Logs", "View the rounds
category_instance.category_header = category_header
init_category_file(category_instance, category_header)
/datum/log_holder/proc/human_readable_timestamp(precision = 3)
var/start = time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss", TIMEZONE_UTC)
// now we grab the millis from the rustg timestamp
var/rustg_stamp = rustg_unix_timestamp()
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)
return "[start].[millis]"
/datum/log_holder/proc/human_readable_timestamp()
return rustg_formatted_timestamp("%Y-%m-%d %H:%M:%S%.3f")
/// Adds an entry to the given category, if the category is disabled it will not be logged.
/// If the category does not exist, we will CRASH and log to the error category.
+1 -1
View File
@@ -8,7 +8,7 @@ export BYOND_MAJOR=516
export BYOND_MINOR=1659
#rust_g git tag
export RUST_G_VERSION=3.8.0
export RUST_G_VERSION=3.9.0
#node version
export NODE_VERSION_LTS=22.11.0
BIN
View File
Binary file not shown.