Servo controlling function...

I tried this one:
#include <SoftwareServo.h>

SoftwareServo servo1;

void setup()
{
pinMode(2, OUTPUT);
servo1.attach(2);

}

void loop()
{
servo1.write(0);
delay(20);
servo1.write(180);
SoftwareServo::refresh();

}

but its the same think , i cant control the time the servo is working .
the delay is not the time the servo will work but the time between the pulses .If you know something about it tell me...