Skip to content

Commit

Permalink
Windows: Fixed compile error in formatHttpTime
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobstanley committed May 28, 2010
1 parent 5463014 commit 9ad0354
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/Snap/Internal/Http/Types.hs
Expand Up @@ -527,26 +527,24 @@ parseHttpTime :: ByteString -> IO CTime

#ifdef WIN32

formatHttpTime = return . format . posixSecondsToUTCTime . toPOSIXTime
formatHttpTime = return . format . toUTCTime
where
format :: UTCTime -> ByteString
format = fromStr . formatTime defaultTimeLocale "%a, %d %b %Y %X GMT"

toPOSIXTime :: CTime -> POSIXTime
toPOSIXTime = realToFrac
toUTCTime :: CTime -> UTCTime
toUTCTime = posixSecondsToUTCTime . realToFrac

formatLogTime = do
t <- utcToLocalZonedTime .
posixSecondsToUTCTime .
toPOSIXTime
return $ format t
formatLogTime ctime = do
t <- utcToLocalZonedTime $ toUTCTime ctime
return $ format t

where
format :: ZonedTime -> ByteString
format = fromStr . formatTime defaultTimeLocale "%d/%b/%Y:%H:%M:%S %z"

toPOSIXTime :: CTime -> POSIXTime
toPOSIXTime = realToFrac
toUTCTime :: CTime -> UTCTime
toUTCTime = posixSecondsToUTCTime . realToFrac


parseHttpTime = return . toCTime . parse . toStr
Expand Down

0 comments on commit 9ad0354

Please sign in to comment.