Servo Motor Code problem

to answer as unspecific as you:

write a routine that creates the servo-control-signal according to the specs of the datasheet of the servo.

In a regular manner read out the time of a real-time-clock (RTC) and compare actual time with the time to spin the servo.

Does this description help? No not at all.
It is the same situation for us with your vague description
you have to describe your project much more specific

  • what servo ? (RC-servo, "real" servo-motor?
  • is there a requirement how fast the servo should spin?
  • how long in time or in rotations
    in case of an RC-servo what angle? at what speed?

which exact type of microcontroller are you using.
additional information that helps to adapt the answers to your knowledge
how much do you know about electronics?

  • voltage?, current?, resistance?

best regards Stefan