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:
parent
bbcffcfefb
commit
8f007074fd
1 changed files with 6 additions and 4 deletions
|
@ -10,9 +10,11 @@ module Article (
|
||||||
import Control.Applicative ((<|>))
|
import Control.Applicative ((<|>))
|
||||||
import Data.Map (Map)
|
import Data.Map (Map)
|
||||||
import qualified Data.Map as Map (fromList, alter)
|
import qualified Data.Map as Map (fromList, alter)
|
||||||
import Data.Time (defaultTimeLocale, getCurrentTimeZone, parseTimeM, timeZoneOffsetString)
|
import Data.Time (
|
||||||
import Data.Time.Clock (UTCTime)
|
UTCTime, defaultTimeLocale, getCurrentTimeZone, parseTimeM
|
||||||
import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds)
|
, timeZoneOffsetString
|
||||||
|
)
|
||||||
|
import Data.Time.Clock.System (systemSeconds, utcToSystemTime)
|
||||||
import System.Directory (getModificationTime)
|
import System.Directory (getModificationTime)
|
||||||
import System.FilePath (dropExtension, takeFileName)
|
import System.FilePath (dropExtension, takeFileName)
|
||||||
import Text.ParserCombinators.Parsec (
|
import Text.ParserCombinators.Parsec (
|
||||||
|
@ -72,7 +74,7 @@ no :: String -> Parser String
|
||||||
no = many1 . noneOf
|
no = many1 . noneOf
|
||||||
|
|
||||||
getTimestamp :: UTCTime -> String
|
getTimestamp :: UTCTime -> String
|
||||||
getTimestamp = show . (truncate :: POSIXTime -> Integer) . utcTimeToPOSIXSeconds
|
getTimestamp = show . systemSeconds . utcToSystemTime
|
||||||
|
|
||||||
setDate :: String -> String -> Metadata -> Metadata
|
setDate :: String -> String -> Metadata -> Metadata
|
||||||
setDate tzOffset defaultDate = Map.alter timeStamp "date"
|
setDate tzOffset defaultDate = Map.alter timeStamp "date"
|
||||||
|
|
Loading…
Reference in a new issue