summaryrefslogtreecommitdiff
path: root/lib/Postdelay/Scan.hs
diff options
context:
space:
mode:
authorGregor Kleen <aethoago@141.li>2017-02-15 19:04:57 +0100
committerGregor Kleen <aethoago@141.li>2017-02-15 19:04:57 +0100
commit127c1212d7704392363e3614f339627bf514cfcf (patch)
tree10e9a0a1f48ec8aef518c3c33a6e34a7043d9738 /lib/Postdelay/Scan.hs
parent5b09b096e38ed231b62df57736e87c989b481b5d (diff)
downloadpostdelay-127c1212d7704392363e3614f339627bf514cfcf.tar
postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar.gz
postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar.bz2
postdelay-127c1212d7704392363e3614f339627bf514cfcf.tar.xz
postdelay-127c1212d7704392363e3614f339627bf514cfcf.zip
Timezones
Diffstat (limited to 'lib/Postdelay/Scan.hs')
-rw-r--r--lib/Postdelay/Scan.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Postdelay/Scan.hs b/lib/Postdelay/Scan.hs
index 888a237..0a265b4 100644
--- a/lib/Postdelay/Scan.hs
+++ b/lib/Postdelay/Scan.hs
@@ -68,10 +68,9 @@ extractDelay (Message headers _) = do
68 zoneHeaders = runListT $ do 68 zoneHeaders = runListT $ do
69 (OptionalField field content) <- ListT $ return headers 69 (OptionalField field content) <- ListT $ return headers
70 guard $ CI.mk field == "X-Timezone" 70 guard $ CI.mk field == "X-Timezone"
71 Right r <- runParserT (spaceConsumer *> lexeme pTimeZone <* eof) field content 71 either throwM return =<< runParserT (spaceConsumer *> lexeme timeZone <* eof) field content
72 return r
73 parseDelay :: Field -> m (Endo LocalTime) 72 parseDelay :: Field -> m (Endo LocalTime)
74 parseDelay (OptionalField field content) = either throwM return =<< runParserT (spaceConsumer *> lexeme pTimeSpec <* eof) field content 73 parseDelay (OptionalField field content) = either throwM return =<< runParserT (spaceConsumer *> lexeme timeSpec <* eof) field content
75 74
76localT :: Either TimeZone TZ -> Iso' UTCTime LocalTime 75localT :: Either TimeZone TZ -> Iso' UTCTime LocalTime
77localT (Left tz) = iso (utcToLocalTime tz) (localTimeToUTC tz) 76localT (Left tz) = iso (utcToLocalTime tz) (localTimeToUTC tz)