Besides perhaps a root canal or a tax audit, few things can be more frustrating than making an appointment to have a cable technician visit your home. You’re given a four-hour window and find yourself waiting and waiting, with no idea when the technician will arrive. Inevitably, it seems, he does not show up until just before the window expires. Or, despite the four-hour time frame, he arrives late.

But now, customers may finally get a small measure of justice for what many complain is unfair and just plain rude treatment at the hands of the cable-company giants.

Under the terms of a new contract negotiated with City Hall, Time Warner Cable and Cablevision will have to pay for failing to honor appointments. And they will have to do a lot more to make sure that subscribers are getting good service.

The contract would make cable customers eligible for a credit equal to a full month’s bill if a technician does not arrive on time. The penalty decreases to $25 after 2012, when Verizon Fios, a competing cable provider, is expected to have built its infrastructure in much of the city, negotiators said on Tuesday.