diff --git a/code/__HELPERS/logging/_logging.dm b/code/__HELPERS/logging/_logging.dm index c9d5bb3cfbe..eb57ff7eda1 100644 --- a/code/__HELPERS/logging/_logging.dm +++ b/code/__HELPERS/logging/_logging.dm @@ -105,7 +105,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global")) SSdbcore.add_log_to_mass_insert_queue( format_table_name("game_log"), list( - "datetime" = SQLtime(), + "datetime" = ISOtime(), "round_id" = "[GLOB.round_id]", "ckey" = key_name(src), "loc" = loc_name(src), diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm index 9c57f2334c8..ac3ff23b05e 100644 --- a/code/__HELPERS/time.dm +++ b/code/__HELPERS/time.dm @@ -28,7 +28,7 @@ SSticker.gametime_offset = CEILING(SSticker.gametime_offset, 3600) //returns timestamp in a sql and a not-quite-compliant ISO 8601 friendly format -/proc/SQLtime(timevar) +/proc/ISOtime(timevar) return time2text(timevar || world.timeofday, "YYYY-MM-DD hh:mm:ss") diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm index b4a2bfe7526..8a4c9c45387 100644 --- a/code/controllers/subsystem/blackbox.dm +++ b/code/controllers/subsystem/blackbox.dm @@ -44,13 +44,17 @@ SUBSYSTEM_DEF(blackbox) return var/playercount = LAZYLEN(GLOB.player_list) var/admincount = GLOB.admins.len - var/datum/db_query/query_record_playercount = SSdbcore.NewQuery(/* NOVA EDIT CHANGE - MULTISERVER */{" + /* // NOVA EDIT CHANGE - MULTISERVER - ORIGINAL: + var/datum/db_query/query_record_playercount = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port, round_id) + VALUES (:playercount, :admincount, NOW(), INET_ATON(:server_ip), :server_port, :round_id) + */ + var/datum/db_query/query_record_playercount = SSdbcore.NewQuery({" INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_name, server_ip, server_port, round_id) - VALUES (:playercount, :admincount, :time, :server_name, INET_ATON(:server_ip), :server_port, :round_id) + VALUES (:playercount, :admincount, NOW(), :server_name, INET_ATON(:server_ip), :server_port, :round_id) "}, list( "playercount" = playercount, "admincount" = admincount, - "time" = SQLtime(), "server_name" = CONFIG_GET(string/serversqlname), // NOVA EDIT ADDITION - MULTISERVER "server_ip" = world.internet_address || "0", "server_port" = "[world.port]", @@ -299,7 +303,7 @@ Versioning var/datum/db_query/query_log_ahelp = SSdbcore.NewQuery({" INSERT INTO [format_table_name("ticket")] (ticket, action, message, recipient, sender, server_ip, server_port, round_id, timestamp, urgent) - VALUES (:ticket, :action, :message, :recipient, :sender, INET_ATON(:server_ip), :server_port, :round_id, :time, :urgent) + VALUES (:ticket, :action, :message, :recipient, :sender, INET_ATON(:server_ip), :server_port, :round_id, NOW(), :urgent) "}, list( "ticket" = ticket, "action" = action, @@ -309,7 +313,6 @@ Versioning "server_ip" = world.internet_address || "0", "server_port" = world.port, "round_id" = GLOB.round_id, - "time" = SQLtime(), "urgent" = urgent, )) query_log_ahelp.Execute() @@ -336,9 +339,14 @@ Versioning if(!SSdbcore.Connect()) return - var/datum/db_query/query_report_death = SSdbcore.NewQuery(/* NOVA EDIT CHANGE - MULTISERVER */{" +/* NOVA EDIT CHANGE - MULTISERVER - ORIGINAL: + var/datum/db_query/query_report_death = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, staminaloss, last_words, suicide) + VALUES (:pod, :x_coord, :y_coord, :z_coord, :map, INET_ATON(:internet_address), :port, :round_id, NOW(), :job, :special, :name, :key, :laname, :lakey, :brute, :fire, :brain, :oxy, :tox, :stamina, :last_words, :suicide) +*/ + var/datum/db_query/query_report_death = SSdbcore.NewQuery({" INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_name, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, staminaloss, last_words, suicide) - VALUES (:pod, :x_coord, :y_coord, :z_coord, :map, :server_name, INET_ATON(:internet_address), :port, :round_id, :time, :job, :special, :name, :key, :laname, :lakey, :brute, :fire, :brain, :oxy, :tox, :clone, :stamina, :last_words, :suicide) + VALUES (:pod, :x_coord, :y_coord, :z_coord, :map, :server_name, INET_ATON(:internet_address), :port, :round_id, NOW(), :job, :special, :name, :key, :laname, :lakey, :brute, :fire, :brain, :oxy, :tox, :clone, :stamina, :last_words, :suicide) "}, list( "name" = L.real_name, "key" = L.ckey, @@ -363,7 +371,6 @@ Versioning "internet_address" = world.internet_address || "0", "port" = "[world.port]", "round_id" = GLOB.round_id, - "time" = SQLtime(), )) if(query_report_death) query_report_death.Execute(async = TRUE) @@ -394,7 +401,7 @@ Versioning :message, :fine, :paid, - :timestamp + NOW() ) ON DUPLICATE KEY UPDATE paid = paid + VALUES(paid)"}, list( "server_ip" = world.internet_address || "0", @@ -408,7 +415,6 @@ Versioning "message" = message, "fine" = fine, "paid" = paid, - "timestamp" = SQLtime() )) if(query_report_citation) query_report_citation.Execute(async = TRUE) diff --git a/code/controllers/subsystem/ipintel.dm b/code/controllers/subsystem/ipintel.dm index f3d14b949dc..db397d51474 100644 --- a/code/controllers/subsystem/ipintel.dm +++ b/code/controllers/subsystem/ipintel.dm @@ -104,7 +104,9 @@ SUBSYSTEM_DEF(ipintel) if(intel.query_status != "success") return intel intel.result = data["result"] - intel.date = SQLtime() + if(istext(intel.result)) + intel.result = text2num(intel.result) + intel.date = ISOtime() intel.address = address cached_queries[address] = intel add_intel_to_database(intel) @@ -158,6 +160,8 @@ SUBSYSTEM_DEF(ipintel) var/datum/ip_intel/intel = new intel.query_status = "cached" intel.result = data["intel"] + if(istext(intel.result)) + intel.result = text2num(intel.result) intel.date = data["date"] intel.address = address return TRUE diff --git a/code/controllers/subsystem/time_track.dm b/code/controllers/subsystem/time_track.dm index ab6d5fb2ed5..aaaf5520e0f 100644 --- a/code/controllers/subsystem/time_track.dm +++ b/code/controllers/subsystem/time_track.dm @@ -123,7 +123,7 @@ SUBSYSTEM_DEF(time_track) send_maps_values += packet["value"] send_maps_values += packet["calls"] - SSblackbox.record_feedback("associative", "time_dilation_current", 1, list("[SQLtime()]" = list("current" = "[time_dilation_current]", "avg_fast" = "[time_dilation_avg_fast]", "avg" = "[time_dilation_avg]", "avg_slow" = "[time_dilation_avg_slow]"))) + SSblackbox.record_feedback("associative", "time_dilation_current", 1, list("[ISOtime()]" = list("current" = "[time_dilation_current]", "avg_fast" = "[time_dilation_avg_fast]", "avg" = "[time_dilation_avg]", "avg_slow" = "[time_dilation_avg_slow]"))) log_perf( list( world.time, diff --git a/code/modules/admin/permissionedit.dm b/code/modules/admin/permissionedit.dm index e92ab1729e2..e508a104739 100644 --- a/code/modules/admin/permissionedit.dm +++ b/code/modules/admin/permissionedit.dm @@ -249,8 +249,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_admin) var/datum/db_query/query_add_admin_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'add admin', :target, CONCAT('New admin added: ', :target)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = .)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'add admin', :target, CONCAT('New admin added: ', :target)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = .)) if(!query_add_admin_log.warn_execute()) qdel(query_add_admin_log) return FALSE @@ -275,8 +275,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_rank) var/datum/db_query/query_add_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'remove admin', :admin_ckey, CONCAT('Admin removed: ', :admin_ckey)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_ckey" = admin_ckey)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'remove admin', :admin_ckey, CONCAT('Admin removed: ', :admin_ckey)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_ckey" = admin_ckey)) if(!query_add_rank_log.warn_execute()) qdel(query_add_rank_log) return @@ -423,8 +423,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_rank) var/datum/db_query/query_add_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'add rank', :new_rank, CONCAT('New rank added: ', :new_rank)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "new_rank" = custom_rank.name)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'add rank', :new_rank, CONCAT('New rank added: ', :new_rank)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "new_rank" = custom_rank.name)) if(!query_add_rank_log.warn_execute()) qdel(query_add_rank_log) return @@ -440,8 +440,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_change_rank) var/datum/db_query/query_change_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'change admin rank', :target, CONCAT('Rank of ', :target, ' changed from ', :old_rank, ' to ', :new_rank)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = admin_ckey, "old_rank" = old_rank, "new_rank" = joined_rank)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'change admin rank', :target, CONCAT('Rank of ', :target, ' changed from ', :old_rank, ' to ', :new_rank)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "target" = admin_ckey, "old_rank" = old_rank, "new_rank" = joined_rank)) if(!query_change_rank_log.warn_execute()) qdel(query_change_rank_log) return @@ -539,8 +539,8 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm qdel(query_add_rank) var/datum/db_query/query_add_rank_log = SSdbcore.NewQuery({" INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) - VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'remove rank', :admin_rank, CONCAT('Rank removed: ', :admin_rank)) - "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_rank" = admin_rank)) + VALUES (NOW(), :round_id, :adminckey, INET_ATON(:adminip), 'remove rank', :admin_rank, CONCAT('Rank removed: ', :admin_rank)) + "}, list("round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "admin_rank" = admin_rank)) if(!query_add_rank_log.warn_execute()) qdel(query_add_rank_log) return diff --git a/code/modules/admin/sql_ban_system.dm b/code/modules/admin/sql_ban_system.dm index bd7b117f14c..2e829862b81 100644 --- a/code/modules/admin/sql_ban_system.dm +++ b/code/modules/admin/sql_ban_system.dm @@ -869,7 +869,7 @@ return var/kn = key_name(usr) var/kna = key_name_admin(usr) - var/change_message = "[usr.client.key] unbanned [target] from [role] on [SQLtime()] during round #[GLOB.round_id]
" + var/change_message = "[usr.client.key] unbanned [target] from [role] on [ISOtime()] during round #[GLOB.round_id]
" var/datum/db_query/query_unban = SSdbcore.NewQuery({" UPDATE [format_table_name("ban")] SET unbanned_datetime = NOW(), @@ -914,7 +914,7 @@ var/kn = key_name(usr) var/kna = key_name_admin(usr) - var/change_message = "[usr.client.key] re-activated ban of [target] from [role] on [SQLtime()] during round #[GLOB.round_id]
" + var/change_message = "[usr.client.key] re-activated ban of [target] from [role] on [ISOtime()] during round #[GLOB.round_id]
" var/datum/db_query/query_reban = SSdbcore.NewQuery({" UPDATE [format_table_name("ban")] SET unbanned_datetime = NULL, diff --git a/code/modules/admin/sql_message_system.dm b/code/modules/admin/sql_message_system.dm index f0c2a7d9400..0246a6a3359 100644 --- a/code/modules/admin/sql_message_system.dm +++ b/code/modules/admin/sql_message_system.dm @@ -52,7 +52,7 @@ return if(isnull(expiry)) if(tgui_alert(usr, "Set an expiry time? Expired messages are hidden like deleted ones.", "Expiry time?", list("Yes", "No", "Cancel")) == "Yes") - var/expire_time = input("Set expiry time for [type] as format YYYY-MM-DD HH:MM:SS. All times in server time. HH:MM:SS is optional and 24-hour. Must be later than current time for obvious reasons.", "Set expiry time", SQLtime()) as null|text + var/expire_time = input("Set expiry time for [type] as format YYYY-MM-DD HH:MM:SS. All times in server time. HH:MM:SS is optional and 24-hour. Must be later than current time for obvious reasons.", "Set expiry time", ISOtime()) as null|text if(!expire_time) return var/datum/db_query/query_validate_expire_time = SSdbcore.NewQuery( @@ -184,7 +184,7 @@ if(!new_text) qdel(query_find_edit_message) return - var/edit_text = "Edited by [editor_key] on [SQLtime()] from
[old_text]
to
[new_text]
" + var/edit_text = "Edited by [editor_key] on [ISOtime()] from
[old_text]
to
[new_text]
" var/datum/db_query/query_edit_message = SSdbcore.NewQuery({" UPDATE [format_table_name("messages")] SET text = :text, lasteditor = :lasteditor, edits = CONCAT(IFNULL(edits,''),:edit_text) @@ -254,7 +254,7 @@ return new_expiry = query_validate_expire_time_edit.item[1] qdel(query_validate_expire_time_edit) - var/edit_text = "Expiration time edited by [editor_key] on [SQLtime()] from [(old_expiry ? old_expiry : "no expiration date")] to [new_expiry]
" + var/edit_text = "Expiration time edited by [editor_key] on [ISOtime()] from [(old_expiry ? old_expiry : "no expiration date")] to [new_expiry]
" var/datum/db_query/query_edit_message_expiry = SSdbcore.NewQuery({" UPDATE [format_table_name("messages")] SET expire_timestamp = :expire_time, lasteditor = :lasteditor, edits = CONCAT(IFNULL(edits,''),:edit_text) @@ -308,7 +308,7 @@ qdel(query_find_edit_note_severity) return new_severity = new_severity - var/edit_text = "Note severity edited by [editor_key] on [SQLtime()] from [old_severity] to [new_severity]
" + var/edit_text = "Note severity edited by [editor_key] on [ISOtime()] from [old_severity] to [new_severity]
" var/datum/db_query/query_edit_note_severity = SSdbcore.NewQuery({" UPDATE [format_table_name("messages")] SET severity = :severity, lasteditor = :lasteditor, edits = CONCAT(IFNULL(edits,''),:edit_text) @@ -352,7 +352,7 @@ var/target_key = query_find_message_secret.item[2] var/admin_key = query_find_message_secret.item[3] var/secret = text2num(query_find_message_secret.item[4]) - var/edit_text = "Made [secret ? "not secret" : "secret"] by [editor_key] on [SQLtime()]
" + var/edit_text = "Made [secret ? "not secret" : "secret"] by [editor_key] on [ISOtime()]
" var/datum/db_query/query_message_secret = SSdbcore.NewQuery({" UPDATE [format_table_name("messages")] SET secret = NOT secret, lasteditor = :lasteditor, edits = CONCAT(IFNULL(edits,''),:edit_text) diff --git a/code/modules/modular_computers/file_system/programs/techweb.dm b/code/modules/modular_computers/file_system/programs/techweb.dm index 2103e0d4a22..1394b9556a6 100644 --- a/code/modules/modular_computers/file_system/programs/techweb.dm +++ b/code/modules/modular_computers/file_system/programs/techweb.dm @@ -197,7 +197,7 @@ if(stored_research.can_afford(price)) user.investigate_log("researched [id]([json_encode(price)]) on techweb id [stored_research.id] via [computer].", INVESTIGATE_RESEARCH) if(istype(stored_research, /datum/techweb/science)) - SSblackbox.record_feedback("associative", "science_techweb_unlock", 1, list("id" = "[id]", "name" = tech_node.display_name, "price" = "[json_encode(price)]", "time" = SQLtime())) + SSblackbox.record_feedback("associative", "science_techweb_unlock", 1, list("id" = "[id]", "name" = tech_node.display_name, "price" = "[json_encode(price)]", "time" = ISOtime())) if(stored_research.research_node_id(id)) computer.say("Successfully researched [tech_node.display_name].") var/logname = "Unknown" diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 8e13c63f792..cc8e842f18e 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -108,7 +108,7 @@ Nothing else in the console has ID requirements. if(stored_research.can_afford(price)) user.investigate_log("researched [id]([json_encode(price)]) on techweb id [stored_research.id].", INVESTIGATE_RESEARCH) if(istype(stored_research, /datum/techweb/science)) - SSblackbox.record_feedback("associative", "science_techweb_unlock", 1, list("id" = "[id]", "name" = TN.display_name, "price" = "[json_encode(price)]", "time" = SQLtime())) + SSblackbox.record_feedback("associative", "science_techweb_unlock", 1, list("id" = "[id]", "name" = TN.display_name, "price" = "[json_encode(price)]", "time" = ISOtime())) if(stored_research.research_node_id(id)) say("Successfully researched [TN.display_name].") var/logname = "Unknown" diff --git a/modular_nova/master_files/code/controllers/subsystem/dbcore.dm b/modular_nova/master_files/code/controllers/subsystem/dbcore.dm index d734bc62f94..a7f223979f8 100644 --- a/modular_nova/master_files/code/controllers/subsystem/dbcore.dm +++ b/modular_nova/master_files/code/controllers/subsystem/dbcore.dm @@ -17,7 +17,7 @@ * * log_entry - Associative list representing all of the information that needs to be logged. * Default format is as follows, for the `game_log` table (even if this could be used for another table): * list( - * "datetime" = SQLtime(), + * "datetime" = ISOtime(), * "round_id" = "[GLOB.round_id]", * "ckey" = key_name(src), * "loc" = loc_name(src),