From e99f1cd836475a059ed6fdcbd4235416ba108dd1 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 03 十二月 2021 17:16:00 +0800
Subject: [PATCH] 1. 新增用电量日分析功能
---
src/main/kotlin/com/flightfeather/uav/dataprocess/AvgPair.kt | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/dataprocess/AvgPair.kt b/src/main/kotlin/com/flightfeather/uav/dataprocess/AvgPair.kt
index 02daa91..aa27311 100644
--- a/src/main/kotlin/com/flightfeather/uav/dataprocess/AvgPair.kt
+++ b/src/main/kotlin/com/flightfeather/uav/dataprocess/AvgPair.kt
@@ -1,11 +1,21 @@
package com.flightfeather.uav.dataprocess
+import kotlin.math.round
+
+/**
+ * 鍧囧�艰绠椾腑闂撮噺
+ * @param t 鎬诲拰
+ * @param c 鎬绘暟
+ */
data class AvgPair(
var t: Float, var c: Int
){
+ /**
+ * 璁$畻缁撴灉
+ */
fun avg(): Float = if (c == 0) {
0f
} else {
- t / c
+ round(t / c * 1000) / 1000
}
}
\ No newline at end of file
--
Gitblit v1.9.3