timestamptzToUTCTime :: (Day, TimeOfDay, Tz) -> UTCTime
timestamptzToUTCTime ((year, month, dayOfMonth), (hour, minute, second, usecond), (hh, mm)) =
  let day = fromGregorian year month dayOfMonth
      time =
        fromIntegral usecond * 1000000 + fromIntegral second * 1000000000000 +
        fromIntegral minute * 60 * 1000000000000 +
        fromIntegral hour * 3600 * 1000000000000 +
        fromIntegral mm * 60 * 1000000000000 +
        fromIntegral hh * 3600 * 1000000000000
  in UTCTime day (picosecondsToDiffTime time)
timestamptzToUTCTime :: (Day, TimeOfDay, Tz) -> UTCTime
timestamptzToUTCTime ((year, month, dayOfMonth), (hour, minute, second, usecond), (hh, mm)) =
  let day = fromGregorian year month dayOfMonth
      time =
        fromIntegral usecond * 1000000 + fromIntegral second * 1000000000000 +
        fromIntegral minute * 60 * 1000000000000 +
        fromIntegral hour * 3600 * 1000000000000 +
        fromIntegral mm * 60 * 1000000000000 +
        fromIntegral hh * 3600 * 1000000000000
  in UTCTime day (picosecondsToDiffTime time)
timestamptzToUTCTime ((year, month, dayOfMonth), (hour, minute, second, usecond), (hh, mm)) =
  let day = fromGregorian year month dayOfMonth
      time =
        fromIntegral usecond * 1000000 + fromIntegral second * 1000000000000 +
        fromIntegral minute * 60 * 1000000000000 +
        fromIntegral hour * 3600 * 1000000000000 +
        fromIntegral mm * 60 * 1000000000000 +
        fromIntegral hh * 3600 * 1000000000000
  in UTCTime day (picosecondsToDiffTime time)