File tree 2 files changed +6
-16
lines changed
2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -446,21 +446,7 @@ class ModLoaderLogCompare:
446
446
# Internal Date Time
447
447
# =============================================================================
448
448
449
- # Import the ModLoaderTime class
450
- const ModLoaderTime = preload ("time.gd" )
451
449
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 )
464
450
465
451
466
452
# Internal File
@@ -504,7 +490,7 @@ static func _rotate_log_file() -> void:
504
490
var error := log_file .open (MOD_LOG_PATH , File .WRITE )
505
491
if not error == OK :
506
492
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 ())
508
494
log_file .close ()
509
495
510
496
Original file line number Diff line number Diff line change
1
+ # ModLoaderTime class
2
+ # This class provides utility functions to retrieve the current time, date, and date-time in specific string formats.
1
3
class_name ModLoaderTime
2
4
extends Node
3
5
@@ -6,11 +8,13 @@ static func get_time_string() -> String:
6
8
var date_time := Time .get_datetime_dict_from_system ()
7
9
return "%02d :%02d :%02d " % [ date_time .hour , date_time .minute , date_time .second ]
8
10
11
+
9
12
# 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 :
11
14
var date_time := Time .get_datetime_dict_from_system ()
12
15
return "%s -%02d -%02d " % [ date_time .year , date_time .month , date_time .day ]
13
16
17
+
14
18
# Returns the current date and time as a string in the format yyyy-mm-dd_hh:mm:ss
15
19
static func get_date_time_string () -> String :
16
20
return "%s _%s " % [ _get_date_string (), _get_time_string () ]
You can’t perform that action at this time.
0 commit comments