Skip to content

Commit 2775522

Browse files
add auto restart time parsing for 12hour format (03:04PM)
1 parent fd38135 commit 2775522

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/managers/gamemgr/autorestart.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ func startAutoRestart(schedule string, done chan struct{}) {
2424
return
2525
}
2626

27+
// Try parsing as a time in HH:MMAM/PM format
28+
if t, err := time.Parse("03:04PM", schedule); err == nil {
29+
// Valid HH:MMAM/PM format, schedule daily restart
30+
go scheduleDailyRestart(t, done)
31+
return
32+
}
33+
2734
// Fallback to parsing as minutes duration
2835
minutesInt, err := strconv.Atoi(schedule)
2936
if err != nil {
3037
logger.Core.Error("Invalid AutoRestartServerTimer format: " + schedule)
3138
return
3239
}
3340
if minutesInt <= 0 {
34-
logger.Core.Error("AutoRestartServerTimer must be a positive number of minutes or valid HH:MM time")
41+
logger.Core.Error("AutoRestartServerTimer must be a positive number of minutes or valid HH:MM or HH:MMAM/PM time")
3542
return
3643
}
3744

0 commit comments

Comments
 (0)