git.iko.soy/typeable/postgresql-simple
on master help sign in
Clean up the code that prints UTC offsets
commit989db9f0c91c03637756ff26995a41cdb4a9a751 authorLeon P Smith <leon@melding-monads.com> dateFri 15 Jan 2016, 06:02 (11 years ago) parentfe5e16c
1 file changed+4−4
src/Database/PostgreSQL/Simple/Time/Internal/Printer.hs+4−4
src/Database/PostgreSQL/Simple/Time/Internal/Printer.hs+4−4
@@ -96,13 +96,13 @@ timeOfDay = f >$< (hh_mm_ >*< ss)
9696 (liftB (fromIntegral >$< digits2) >*< frac)
9797
9898timeZone :: BoundedPrim TimeZone
99−timeZone = ((`quotRem` 60) . timeZoneMinutes) >$< (liftB tzh >*< tzm)
99+timeZone = timeZoneMinutes >$< tz
100100 where
101− f h = if h >= 0 then ('+', h) else (,) '-' $! (-h)
101+ tz = condB (>= 0) ((,) '+' >$< tzh) ((,) '-' . negate >$< tzh)
102102
103− tzh = f >$< (char8 >*< digits2)
103+ tzh = liftB char8 >*< ((`quotRem` 60) >$< (liftB digits2 >*< tzm))
104104
105− tzm = condB (==0) emptyB ((,) ':' . abs >$< liftB (char8 >*< digits2))
105+ tzm = condB (==0) emptyB ((,) ':' >$< liftB (char8 >*< digits2))
106106
107107utcTime :: BoundedPrim UTCTime
108108utcTime = f >$< (day >*< liftB char8 >*< timeOfDay >*< liftB char8)