-
Notifications
You must be signed in to change notification settings - Fork 86
/
Main.hs
38 lines (32 loc) · 1.15 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# LANGUAGE NumericUnderscores #-}
module Main
where
import Control.Concurrent (threadDelay)
import Control.Concurrent.Async
import Control.Monad (forever)
import Control.Tracer
import Network.NTP.Client (withNtpClient
, NtpSettings(..)
, NtpClient(..))
import System.IOManager
main :: IO ()
main =
withIOManager $ \ioManager ->
withNtpClient ioManager (showTracing stdoutTracer) testSettings runApplication
where
runApplication ntpClient = do
link $ ntpThread ntpClient -- propergate any errors in the NTP thread.
forever (threadDelay maxBound)
testSettings :: NtpSettings
testSettings = NtpSettings
{ ntpServers = [ "0.de.pool.ntp.org"
, "0.europe.pool.ntp.org"
, "0.pool.ntp.org"
, "1.pool.ntp.org"
, "2.pool.ntp.org"
, "3.pool.ntp.org"
]
, ntpRequiredNumberOfResults = 5
, ntpResponseTimeout = fromInteger 1_000_000
, ntpPollDelay = fromInteger 10_000_000
}