diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-05-10 15:36:58 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-05-10 15:36:58 -0400 |
commit | cb994264d239ca4ac50402175a7fd7ac89e029d6 (patch) | |
tree | 4b7c4d05e045fc4593812746274b1898176cb216 /Logs/TimeStamp.hs | |
parent | 724e67bdf449120bdaf0ca695d49626e5249d446 (diff) |
more time-1.5 fixes
Diffstat (limited to 'Logs/TimeStamp.hs')
-rw-r--r-- | Logs/TimeStamp.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Logs/TimeStamp.hs b/Logs/TimeStamp.hs index 121b76678..ca2670953 100644 --- a/Logs/TimeStamp.hs +++ b/Logs/TimeStamp.hs @@ -17,9 +17,14 @@ import System.Locale import Common +{- Parses how POSIXTime shows itself: "1431286201.113452s" + - Also handles the format with no fractional seconds. -} parsePOSIXTime :: String -> Maybe POSIXTime #if MIN_VERSION_time(1,5,0) parsePOSIXTime s = utcTimeToPOSIXSeconds <$> parseTimeM True defaultTimeLocale "%s%Qs" s #else parsePOSIXTime s = utcTimeToPOSIXSeconds <$> parseTime defaultTimeLocale "%s%Qs" s #endif + +formatPOSIXTime :: String -> POSIXTime -> String +formatPOSIXTime fmt t = formatTime defaultTimeLocale fmt (posixSecondsToUTCTime t) |