init
This commit is contained in:
22
pkg/libyear/libyear.go
Normal file
22
pkg/libyear/libyear.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package libyear
|
||||
|
||||
import "time"
|
||||
|
||||
type Info struct {
|
||||
Version string // version string
|
||||
Time time.Time // commit time
|
||||
}
|
||||
|
||||
type Pair struct {
|
||||
Name string
|
||||
Latest Info
|
||||
Current Info
|
||||
}
|
||||
|
||||
func Calc(p ...Pair) time.Duration {
|
||||
sum := time.Duration(0)
|
||||
for i := range p {
|
||||
sum = sum + p[i].Latest.Time.Sub(p[i].Current.Time)
|
||||
}
|
||||
return sum
|
||||
}
|
Reference in New Issue
Block a user