mirror of
https://github.com/input-output-hk/foliage.git
synced 2024-12-02 07:54:45 +03:00
080197e9e2
1. Foliage takes as input a complete description of the index, where source distributions and revisions come with a timestamp. This allows us to recreate the entire index in a reproducible way. 2. Added a experimental command to import an index from a Hackage (as downloaded with Cabal). This was originally a testing/development need but there might be different use cases.
28 lines
609 B
Haskell
28 lines
609 B
Haskell
{-# LANGUAGE TypeApplications #-}
|
|
{-# OPTIONS_GHC -Wno-orphans #-}
|
|
|
|
module Foliage.Time
|
|
( iso8601ParseM,
|
|
iso8601Show,
|
|
getCurrentTime,
|
|
UTCTime (..),
|
|
utcTimeToPOSIXSeconds,
|
|
addUTCTime,
|
|
nominalDay,
|
|
truncateSeconds,
|
|
)
|
|
where
|
|
|
|
import Data.Time
|
|
import Data.Time.Clock.POSIX
|
|
import Data.Time.Compat ()
|
|
import Data.Time.Format.ISO8601
|
|
import Development.Shake.Classes
|
|
|
|
instance Binary UTCTime where
|
|
get = iso8601ParseM =<< get
|
|
put = put . iso8601Show
|
|
|
|
truncateSeconds :: UTCTime -> UTCTime
|
|
truncateSeconds = posixSecondsToUTCTime . fromIntegral @Int . floor . utcTimeToPOSIXSeconds
|