longest trace

This commit is contained in:
mr
2026-03-20 15:21:48 +01:00
parent 75d08aae7c
commit e4506f3b42

View File

@@ -1,23 +1,23 @@
package common
import (
"fmt"
"time"
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
"cloud.o-forge.io/core/oc-lib/tools"
)
func GetPlannerNearestStart(start time.Time, planned map[tools.DataType]map[string]pricing.PricedItemITF) float64 {
near := float64(-1) // unset sentinel
near := float64(-1) // unset sentinel
for _, items := range planned { // loop through the planned items
for _, priced := range items { // loop through the priced items
if priced.GetLocationStart() == nil { // if the start is nil,
continue // skip the iteration
}
newS := priced.GetLocationStart() // get the start
diff := newS.Sub(start).Seconds() // get the difference
if near < 0 || diff < near { // if the difference is less than the nearest start
newS := priced.GetLocationStart() // get the start
diff := newS.Sub(start).Seconds() // get the difference
if near < 0 || diff < near { // if the difference is less than the nearest start
near = diff
}
}
@@ -32,6 +32,7 @@ func GetPlannerLongestTime(planned map[tools.DataType]map[string]pricing.PricedI
longestTime := float64(0)
for _, priced := range planned[tools.PROCESSING_RESOURCE] {
longestTime += priced.GetExplicitDurationInS()
fmt.Println("Longest", longestTime)
}
return longestTime
}