config: Use float64 within the autosave processing

This commit is contained in:
Jöran Karl
2024-06-19 21:10:52 +02:00
parent 832c7deaf8
commit 4170df89eb
3 changed files with 6 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ import (
)
var Autosave chan bool
var autotime int
var autotime float64
// lock for autosave
var autolock sync.Mutex
@@ -15,7 +15,7 @@ func init() {
Autosave = make(chan bool)
}
func SetAutoTime(a int) {
func SetAutoTime(a float64) {
autolock.Lock()
autotime = a
autolock.Unlock()
@@ -27,10 +27,10 @@ func StartAutoSave() {
autolock.Lock()
a := autotime
autolock.Unlock()
if a < 1 {
if a <= 0 {
break
}
time.Sleep(time.Duration(a) * time.Second)
time.Sleep(time.Duration(a * float64(time.Second)))
Autosave <- true
}
}()