mirror of https://github.com/curusarn/resh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
380 B
18 lines
380 B
package epochtime
|
|
|
|
import (
|
|
"strconv"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestConversion(t *testing.T) {
|
|
epochTime := "1672702332.64"
|
|
seconds, err := strconv.ParseFloat(epochTime, 64)
|
|
if err != nil {
|
|
t.Fatal("Test setup failed: Failed to convert constant")
|
|
}
|
|
if TimeToString(time.UnixMilli(int64(seconds*1000))) != epochTime {
|
|
t.Fatal("EpochTime changed during conversion")
|
|
}
|
|
}
|
|
|