Near optimal time boundary controllability for a class of hyperbolic equations