From 4a5cc6d0e0fad0d900e97c7fbb9675b4e9127549 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 3 Jan 2021 18:21:12 +0100 Subject: [PATCH] make affection strict --- src/Affection.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Affection.hs b/src/Affection.hs index 6373bea..64e8d29 100644 --- a/src/Affection.hs +++ b/src/Affection.hs @@ -1,5 +1,5 @@ {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE Strict #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RankNTypes #-} @@ -111,9 +111,9 @@ withAffection AffectionConfig{..} = do now <- liftIO $ getTime Monotonic let lastTime = sysTime ad -- compute dt and update elapsedTime - let !dt = fromIntegral + let dt = fromIntegral (toNanoSecs $ diffTimeSpec lastTime now) / (10 ^ (9 :: Int)) - !ne = elapsedTime ad + dt + ne = elapsedTime ad + dt -- update state data object with new time values put $ ad { elapsedTime = ne