Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A blind attempt to support *BSD. #29

Merged
merged 1 commit into from
Jun 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 we can't systematically predict 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