Is this drain setup legal?
The two 22-1/2&deg; elbows should have been in your horizontal run, moving the trap underneath and in line with the sink tailpiece. The tailpiece should remain straight. I'm not sure if this violates code, but it's unlikely to be a problem. 

The length of your horizontal arm is fine. I don't know the code there, either, but it's not out of the ordinary. The maximum length partially depends on slope, and you don't run into any issues at 17".