File: Model.hs

package info (click to toggle)
haskell-http-date 0.0.11-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92 kB
  • sloc: haskell: 349; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 470 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE CPP #-}

module Model where

import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as BS8
import Data.Time
import Data.Time.Clock.POSIX
import System.Posix.Types

#if !MIN_VERSION_time(1,5,0)
import System.Locale
#endif

epochTimeToUtcTime :: EpochTime -> UTCTime
epochTimeToUtcTime = posixSecondsToUTCTime . realToFrac

utcToDate :: UTCTime -> ByteString
utcToDate = BS8.pack . formatTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S GMT"