git.iko.soy/typeable/postgresql-simple
on master help sign in
Clean up the code that prints UTC offsets
989db9fLeon P Smith
src/Database/PostgreSQL/Simple/Time/Internal/Printer.hs+4−4
@@ -96,13 +96,13 @@ timeOfDay = f >$< (hh_mm_ >*< ss)
96 (liftB (fromIntegral >$< digits2) >*< frac)
96 (liftB (fromIntegral >$< digits2) >*< frac)
97
97
98timeZone :: BoundedPrim TimeZone
98timeZone :: BoundedPrim TimeZone
99−timeZone = ((`quotRem` 60) . timeZoneMinutes) >$< (liftB tzh >*< tzm)
99+timeZone = timeZoneMinutes >$< tz
100 where
100 where
101− f h = if h >= 0 then ('+', h) else (,) '-' $! (-h)
101+ tz = condB (>= 0) ((,) '+' >$< tzh) ((,) '-' . negate >$< tzh)
102
102
103− tzh = f >$< (char8 >*< digits2)
103+ tzh = liftB char8 >*< ((`quotRem` 60) >$< (liftB digits2 >*< tzm))
104
104
105− tzm = condB (==0) emptyB ((,) ':' . abs >$< liftB (char8 >*< digits2))
105+ tzm = condB (==0) emptyB ((,) ':' >$< liftB (char8 >*< digits2))
106
106
107utcTime :: BoundedPrim UTCTime
107utcTime :: BoundedPrim UTCTime
108utcTime = f >$< (day >*< liftB char8 >*< timeOfDay >*< liftB char8)
108utcTime = f >$< (day >*< liftB char8 >*< timeOfDay >*< liftB char8)