Skip to content

Commit 4f82dd9

Browse files
authored
resolved the suggestions
1 parent c66631d commit 4f82dd9

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

addons/mod_loader/api/log.gd

+1-15
Original file line numberDiff line numberDiff line change
@@ -446,21 +446,7 @@ class ModLoaderLogCompare:
446446
# Internal Date Time
447447
# =============================================================================
448448

449-
# Import the ModLoaderTime class
450-
const ModLoaderTime = preload("time.gd")
451449

452-
# This create an instance of ModLoaderTime
453-
var time_utils = ModLoaderTime.new()
454-
455-
# ModLoaderTime instance Function
456-
func _ready():
457-
var time_str = time_utils._get_time_string()
458-
var date_str = time_utils._get_date_string()
459-
var date_time_str = time_utils._get_date_time_string()
460-
461-
print("Time: ", time_str)
462-
print("Date: ", date_str)
463-
print("Date-Time: ", date_time_str)
464450

465451

466452
# Internal File
@@ -504,7 +490,7 @@ static func _rotate_log_file() -> void:
504490
var error := log_file.open(MOD_LOG_PATH, File.WRITE)
505491
if not error == OK:
506492
assert(false, "Could not open log file, error code: %s" % error)
507-
log_file.store_string('%s Created log' % _get_date_string())
493+
log_file.store_string('%s Created log' % ModLoaderTime.get_date_string())
508494
log_file.close()
509495

510496

addons/mod_loader/api/time.gd

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ModLoaderTime class
2+
# This class provides utility functions to retrieve the current time, date, and date-time in specific string formats.
13
class_name ModLoaderTime
24
extends Node
35

@@ -6,11 +8,13 @@ static func get_time_string() -> String:
68
var date_time := Time.get_datetime_dict_from_system()
79
return "%02d:%02d:%02d" % [ date_time.hour, date_time.minute, date_time.second ]
810

11+
912
# Returns the current date as a string in the format yyyy-mm-dd
10-
static func _get_date_string() -> String:
13+
static func get_date_string() -> String:
1114
var date_time := Time.get_datetime_dict_from_system()
1215
return "%s-%02d-%02d" % [ date_time.year, date_time.month, date_time.day ]
1316

17+
1418
# Returns the current date and time as a string in the format yyyy-mm-dd_hh:mm:ss
1519
static func get_date_time_string() -> String:
1620
return "%s_%s" % [ _get_date_string(), _get_time_string() ]

0 commit comments

Comments
 (0)