* `make` works again, exporting correct database file path for local dev * better formatting of durations * refactored duration math to misc functions * now tracks and displays score * displays short-lifetime fp wipeouts in reddev
parent
fe1c4df4f1
commit
0d9ed8874f
@ -0,0 +1,20 @@ |
||||
package hn |
||||
|
||||
import ( |
||||
"math" |
||||
"time" |
||||
|
||||
"github.com/hako/durafmt" |
||||
) |
||||
|
||||
func timeDiffHuman(first time.Time, second time.Time) string { |
||||
if first.Before(second) { |
||||
return durafmt.ParseShort(second.Sub(first)).String() |
||||
} else { |
||||
return durafmt.ParseShort(first.Sub(second)).String() |
||||
} |
||||
} |
||||
|
||||
func timeDiffAbsSeconds(first time.Time, second time.Time) uint { |
||||
return uint(math.Abs(first.Sub(second).Truncate(time.Second).Seconds())) |
||||
} |
Loading…
Reference in new issue