One thing you can implement for improving time on task in class is to use positive reinforcement consistently and often. You will want to ignore the behaviors students display when they are off-task and praise, or pay attention to them when they are on task. As soon as you see your student stop looking out the window and focus on his paper, call attention to it. "I see Billy is reading his worksheet." "I see Rachel working hard on her multiplication problems." This can be very difficult and requires you to almost keep a constant watch on the students with ADHD to deliver the positive reinforcement.
If you don't feel the positive reinforcement alone is improving time on task in class, then you could try walking closer to the student when he/she is off-task. You wouldn't say anything to him/her about getting to work, but sometimes it helps a student with ADHD to focus if his/her teacher is in close proximity. When you are standing near the student as soon as you see him/her on-task, you will want to call attention to his behavior. "I see John has written his entire first paragraph."
Besides positive reinforcement, you can also help your students with ADHD stay on-task by giving them a seat away from the windows and pencil sharpener. You can also remind them to get all their supplies ready in the morning, so they are ready when it is time for classwork.