mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
config: Use float64 within the autosave processing
This commit is contained in:
@@ -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
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user