From 54303a9257e01de754495cc0faa72cb8a8c85ff7 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 23 Sep 2014 20:00:19 -0400 Subject: [PATCH] Fix the time_stamp_format and the timestamp pickler for time-1.4.2. --- src/TSN/Parse.hs | 10 +++++----- src/TSN/Picklers.hs | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/TSN/Parse.hs b/src/TSN/Parse.hs index d707f5f..8dbdf1f 100644 --- a/src/TSN/Parse.hs +++ b/src/TSN/Parse.hs @@ -184,15 +184,15 @@ time_format = "%I:%M %p" --- | The format string for a time_stamp. We keep the leading/trailing --- space so that parseTime and formatTime are inverses are one --- another, even though there is some confusion as to how these two --- functions should behave: +-- | The format string for a time_stamp. We have removed the +-- leading/trailing space so that parseTime and formatTime are NOT +-- inverses of one another. We should be able to rectify this once +-- everything is updated to support time-1.5. See, -- -- -- time_stamp_format :: String -time_stamp_format = " %B %-d, %Y, at " ++ time_format ++ " ET " +time_stamp_format = "%B %-d, %Y, at " ++ time_format ++ " ET" diff --git a/src/TSN/Picklers.hs b/src/TSN/Picklers.hs index 09c3a3b..70fa07d 100644 --- a/src/TSN/Picklers.hs +++ b/src/TSN/Picklers.hs @@ -474,9 +474,12 @@ xp_time_stamp :: PU UTCTime xp_time_stamp = (parse_time_stamp, from_time_stamp) `xpWrapMaybe` xpText where + -- | We have to re-pad the time_stamp_format with a leading and + -- trailing space; see the documentation of 'time_stamp_format' + -- for more information. from_time_stamp :: UTCTime -> String from_time_stamp = - formatTime defaultTimeLocale time_stamp_format + formatTime defaultTimeLocale (" " ++ time_stamp_format ++ " ") -- 2.44.2