Skip to content

Commit

Permalink
A blind attempt to support *BSD.
Browse files Browse the repository at this point in the history
Pinging @cgag. Attempts to fix #22. Untested, since I don't have a BSD handy.
  • Loading branch information
mboes committed Jun 27, 2015
1 parent 9aa16a6 commit b2d2f8b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion System/Clock.hsc
Expand Up @@ -4,6 +4,9 @@
-- <http://www.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html#>

{-# OPTIONS_GHC -fno-warn-type-defaults #-}
-- To allow importing Data.Int and Data.Word indiscriminately on all platforms,
-- since it's not always clear what typedef's expand to.
{-# OPTIONS_GHC -fno-warn-unused-imports #-}

module System.Clock
( Clock(..)
Expand All @@ -16,6 +19,7 @@ module System.Clock

import Control.Applicative ((<$>), (<*>))
import Data.Int
import Data.Word
import Data.Typeable (Typeable)
import Foreign.Ptr
import Foreign.Storable
Expand Down Expand Up @@ -189,7 +193,7 @@ instance Num TimeSpec where
-- seconds
(fromInteger $ xsi * ysi)
-- nanoseconds
(fromInteger $ (xni * yni + (xni * ysi + xsi * yni) * (10^9))
(fromInteger $ (xni * yni + (xni * ysi + xsi * yni) * (10^9))
`div` (10^9))
negate (TimeSpec xs xn) =
normalize $ TimeSpec (negate xs) (negate xn)
Expand Down

0 comments on commit b2d2f8b

Please sign in to comment.