static int compareAtTime(Rule rule, DstTime x, int time)
{
int atTime = x.atTime;
// if universal time, then we need to move atTime back to
// local time (we might cross into the previous day)
if (x.atMode == 'u')
{
if (rule.offset + x.atTime < 0)
atTime = 24*60*60 + rule.offset + x.atTime;
else
atTime += rule.offset;
}
if (atTime < time) return -1;
if (atTime > time) return +1;
return 0;
}