Problem with server.sleepuntil()

I wanted the Imp to take readings at 0600 UTC, so I used server.sleepuntil(6,0). The result was that the Imp came to life at about 0559, took the readings, and went back to sleep until 0600, which was a few seconds later. So I get two sets of readings a day, not the desired single set.

What I assume was happening was that the internal timer was running a little fast, causing the early wakeup. Then the wifi connection corrects the timer, which leads to the second wakeup.

How can I get around this?

You can get the current day of the week from date() and then increment that and pass it to server.sleepuntil.

Great idea. Thanks.