Integer delay = 1;
for(Integer i=1;i<=5;i++)
{
System.debug('Print '+i);
Long sTime = System.now().getTime();
while ( (System.now().getTime()/1000 - sTime/1000) < delay){}
}
When I executed the above code in anonymous window and checked the log, it is printing only 4 and 5. not sure why it is skipping 1,2 and 3.