summaryrefslogtreecommitdiff
path: root/lib/Postdelay/TimeSpec.hs
diff options
context:
space:
mode:
authorGregor Kleen <aethoago@141.li>2017-01-30 13:33:33 +0100
committerGregor Kleen <aethoago@141.li>2017-01-30 13:33:33 +0100
commita45fa188046ab652150d332f48202f0e3fa5ea82 (patch)
tree36d54dbfb82f2127a86b105a27df34339e370d17 /lib/Postdelay/TimeSpec.hs
parentf5d85473fc1f59dc63f184a118c08af02f025345 (diff)
downloadpostdelay-a45fa188046ab652150d332f48202f0e3fa5ea82.tar
postdelay-a45fa188046ab652150d332f48202f0e3fa5ea82.tar.gz
postdelay-a45fa188046ab652150d332f48202f0e3fa5ea82.tar.bz2
postdelay-a45fa188046ab652150d332f48202f0e3fa5ea82.tar.xz
postdelay-a45fa188046ab652150d332f48202f0e3fa5ea82.zip
Support a X-Timezone header
Diffstat (limited to 'lib/Postdelay/TimeSpec.hs')
-rw-r--r--lib/Postdelay/TimeSpec.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Postdelay/TimeSpec.hs b/lib/Postdelay/TimeSpec.hs
index af8d801..676dabf 100644
--- a/lib/Postdelay/TimeSpec.hs
+++ b/lib/Postdelay/TimeSpec.hs
@@ -2,6 +2,7 @@
2 2
3module Postdelay.TimeSpec 3module Postdelay.TimeSpec
4 ( pTimeSpec 4 ( pTimeSpec
5 , pTimeZone
5 , TimeCtx(..) 6 , TimeCtx(..)
6 ) where 7 ) where
7 8
@@ -308,7 +309,7 @@ pTimeBase = choice' [ do
308 pMinute = ensure (< 60) =<< natural 309 pMinute = ensure (< 60) =<< natural
309 pSecond = decimal 310 pSecond = decimal
310 311
311pTimeZone :: MonadTP m => ParsecT String () m (Either TimeZone TZ) 312pTimeZone :: MonadIO m => ParsecT String () m (Either TimeZone TZ)
312pTimeZone = choice' [ do 313pTimeZone = choice' [ do
313 sgn <- choice [ id <$ char '+' 314 sgn <- choice [ id <$ char '+'
314 , negate <$ char '-' 315 , negate <$ char '-'
@@ -317,7 +318,9 @@ pTimeZone = choice' [ do
317 ms <- option 0 $ (\d u -> 10 * d + u) <$> digit <*> digit 318 ms <- option 0 $ (\d u -> 10 * d + u) <$> digit <*> digit
318 return . Left . minutesToTimeZone $ hs * 60 + ms 319 return . Left . minutesToTimeZone $ hs * 60 + ms
319 , do 320 , do
320 n <- many1 $ letter <|> char '/' 321 let
322 ident = (++) <$> many1 alphaNum <*> option "" ((:) <$> oneOf "_-/.+" <*> ident)
323 n <- ident
321 tz <- liftIO $ do 324 tz <- liftIO $ do
322 let 325 let
323 fbHandler :: IO a -> (IOException -> IO a) 326 fbHandler :: IO a -> (IOException -> IO a)