From: Michael Orlitzky Date: Wed, 24 Sep 2014 00:00:19 +0000 (-0400) Subject: Fix the time_stamp_format and the timestamp pickler for time-1.4.2. X-Git-Tag: 0.1.1~6 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=54303a9257e01de754495cc0faa72cb8a8c85ff7;p=dead%2Fhtsn-import.git Fix the time_stamp_format and the timestamp pickler for time-1.4.2. --- 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 ++ " ")