Avoid using a «Most people won't need this» module and use an intermediate value that is not meant to represent a duration

This commit is contained in:
Tissevert 2020-01-08 15:42:30 +01:00
parent bbcffcfefb
commit 8f007074fd

View file

@ -10,9 +10,11 @@ module Article (
import Control.Applicative ((<|>))
import Data.Map (Map)
import qualified Data.Map as Map (fromList, alter)
import Data.Time (defaultTimeLocale, getCurrentTimeZone, parseTimeM, timeZoneOffsetString)
import Data.Time.Clock (UTCTime)
import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds)
import Data.Time (
UTCTime, defaultTimeLocale, getCurrentTimeZone, parseTimeM
, timeZoneOffsetString
)
import Data.Time.Clock.System (systemSeconds, utcToSystemTime)
import System.Directory (getModificationTime)
import System.FilePath (dropExtension, takeFileName)
import Text.ParserCombinators.Parsec (
@ -72,7 +74,7 @@ no :: String -> Parser String
no = many1 . noneOf
getTimestamp :: UTCTime -> String
getTimestamp = show . (truncate :: POSIXTime -> Integer) . utcTimeToPOSIXSeconds
getTimestamp = show . systemSeconds . utcToSystemTime
setDate :: String -> String -> Metadata -> Metadata
setDate tzOffset defaultDate = Map.alter timeStamp "date"