huge refactoring

This commit is contained in:
Julien Neuhart
2019-07-23 13:57:18 +02:00
parent f6b357691c
commit 7bfbda4490
105 changed files with 4051 additions and 2667 deletions

View File

@@ -0,0 +1,6 @@
/*
Package xtime helps generating
time.Duration from seconds represented
as float64.
*/
package xtime

View File

@@ -0,0 +1,10 @@
package xtime
import (
"time"
)
// Duration creates a time.Duration from seconds.
func Duration(seconds float64) time.Duration {
return time.Duration(1000*seconds) * time.Millisecond
}

View File

@@ -0,0 +1,14 @@
package xtime
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestDuration(t *testing.T) {
expected := time.Duration(1500) * time.Millisecond
result := Duration(1.5)
assert.Equal(t, expected.String(), result.String())
}