aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Timer.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/Timer.elm')
-rw-r--r--src/Model/Timer.elm12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Model/Timer.elm b/src/Model/Timer.elm
index ddbe97b..7d345b2 100644
--- a/src/Model/Timer.elm
+++ b/src/Model/Timer.elm
@@ -10,7 +10,8 @@ import Time (Time)
type alias Timer =
{ creationTime : Time
, name : String
- , time : Time
+ , initialTime : Time
+ , currentTime : Time
, isRunning : Bool
}
@@ -18,7 +19,8 @@ initialTimer : Time -> String -> Timer
initialTimer creationTime name =
{ creationTime = creationTime
, name = name
- , time = 5 * 60 * 1000
+ , initialTime = 5 * 60 * 1000
+ , currentTime = 5 * 60 * 1000
, isRunning = True
}
@@ -26,15 +28,15 @@ substractTimerTime : Time -> Timer -> Timer
substractTimerTime time timer =
if timer.isRunning
then
- if timer.time - time <= 0.0
+ if timer.currentTime - time <= 0.0
then
{ timer
- | time <- 0.0
+ | currentTime <- 0.0
, isRunning <- False
}
else
{ timer
- | time <- timer.time - time
+ | currentTime <- timer.currentTime - time
}
else
timer