OSDN Git Service

varを使わないように変更
authormasakih <masakih@users.sourceforge.jp>
Sun, 15 Oct 2017 03:04:07 +0000 (12:04 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 15 Oct 2017 03:04:07 +0000 (12:04 +0900)
KCD/ResourceHistoryManager.swift

index a37ce67..47c9aa6 100644 (file)
@@ -81,9 +81,8 @@ final class ResourceHistoryManager: NSObject {
         let now = Date()
         var nowComp = Calendar.current
             .dateComponents([.year, .month, .day, .hour, .minute], from: now)
-        var minutes = nowComp.minute.map { ($0 + 2) / 5 } ?? 0
-        minutes *= 5
-        nowComp.minute = minutes
+        let minutes = nowComp.minute.map { ($0 + 2) / 5 } ?? 0
+        nowComp.minute = minutes * 5
         
         newHistory.date = Calendar.current.date(from: nowComp)!
         newHistory.minute = (minutes != 60) ? minutes : 0