@@ -231,14 +231,14 @@ dateToBuilder = unboundedToBuilder dayToBuilder
231231
232232nominalDiffTimeToBuilder :: NominalDiffTime -> Builder
233233nominalDiffTimeToBuilder xyz
234− | yz == 0 = integral x
235− | z == 0 = integral x ++ fromChar '.' ++ showD6 y
236− | otherwise = integral x ++ fromChar '.' ++ pad6 y ++ showD6 z
234+ | yz < 500000 = sign ++ integral x
235+ | otherwise = sign ++ integral x ++ fromChar '.' ++ showD6 y
237236 where
238237 -- A kludge to work around the fact that Data.Fixed isn't very fast and
239238 -- doesn't give me access to the MkFixed constructor.
240− (x,yz) = (unsafeCoerce xyz :: Integer) `quotRem` 1000000000000
241− (fromIntegral -> y, fromIntegral -> z) = yz `quotRem` 1000000
239+ sign = if xyz >= 0 then mempty else fromChar '-'
240+ (x,yz) = ((unsafeCoerce (abs xyz) :: Integer) + 500000) `quotRem` 1000000000000
241+ (fromIntegral -> y, _z) = yz `quotRem` 1000000
242242
243243showSeconds :: Pico -> Builder
244244showSeconds xyz