timeBetween computes hours between two ISO timestamps.
(from, to string)
| 288 | |
| 289 | // timeBetween computes hours between two ISO timestamps. |
| 290 | func timeBetween(from, to string) float64 { |
| 291 | t1, err1 := time.Parse(time.RFC3339, from) |
| 292 | t2, err2 := time.Parse(time.RFC3339, to) |
| 293 | if err1 != nil || err2 != nil { |
| 294 | return 0 |
| 295 | } |
| 296 | return t2.Sub(t1).Hours() |
| 297 | } |
| 298 | |
| 299 | // medianFloat returns the median of a float slice. |
| 300 | func medianFloat(vals []float64) float64 { |
no outgoing calls