module Data.HodaTime.TimeZone
(
TimeZone
,utc
,localZone
,timeZone
,availableZones
)
where
import Data.HodaTime.TimeZone.Internal
import Data.HodaTime.TimeZone.Platform
utc :: IO TimeZone
utc :: IO TimeZone
utc = do
(UtcTransitionsMap
utcM, CalDateTransitionsMap
calDateM) <- IO (UtcTransitionsMap, CalDateTransitionsMap)
loadUTC
TimeZone -> IO TimeZone
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TimeZone -> IO TimeZone) -> TimeZone -> IO TimeZone
forall a b. (a -> b) -> a -> b
$ TZIdentifier
-> UtcTransitionsMap -> CalDateTransitionsMap -> TimeZone
TimeZone TZIdentifier
UTC UtcTransitionsMap
utcM CalDateTransitionsMap
calDateM
timeZone :: String -> IO TimeZone
timeZone :: String -> IO TimeZone
timeZone String
tzName = do
(UtcTransitionsMap
utcM, CalDateTransitionsMap
calDateM) <- String -> IO (UtcTransitionsMap, CalDateTransitionsMap)
loadTimeZone String
tzName
TimeZone -> IO TimeZone
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TimeZone -> IO TimeZone) -> TimeZone -> IO TimeZone
forall a b. (a -> b) -> a -> b
$ TZIdentifier
-> UtcTransitionsMap -> CalDateTransitionsMap -> TimeZone
TimeZone (String -> TZIdentifier
Zone String
tzName) UtcTransitionsMap
utcM CalDateTransitionsMap
calDateM
localZone :: IO TimeZone
localZone :: IO TimeZone
localZone = do
(UtcTransitionsMap
utcM, CalDateTransitionsMap
calDateM, String
tzName) <- IO (UtcTransitionsMap, CalDateTransitionsMap, String)
loadLocalZone
TimeZone -> IO TimeZone
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TimeZone -> IO TimeZone) -> TimeZone -> IO TimeZone
forall a b. (a -> b) -> a -> b
$ TZIdentifier
-> UtcTransitionsMap -> CalDateTransitionsMap -> TimeZone
TimeZone (String -> TZIdentifier
Zone String
tzName) UtcTransitionsMap
utcM CalDateTransitionsMap
calDateM
availableZones :: IO [String]
availableZones :: IO [String]
availableZones = IO [String]
loadAvailableZones