begin adding sd.Card refactor

This commit is contained in:
soypat
2024-01-14 02:31:41 -03:00
parent 0262122ccd
commit 5b6571350d
5 changed files with 830 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package sd
import (
"time"
)
var timeoutTimer [2]timer
type timer struct {
start int64
timeout int64
}
func setTimeout(timerID int, timeout time.Duration) *timer {
timeoutTimer[timerID].start = time.Now().UnixNano()
timeoutTimer[timerID].timeout = timeout.Nanoseconds()
return &timeoutTimer[timerID]
}
func (t timer) expired() bool {
return time.Now().UnixNano() > (t.start + t.timeout)
}