For 80x86; if the OS is something like MS-DOS or "none" then you'd want to poll the BIOS's "ticks since midnight" in a loop while doing HLT (to save power). To get the "ticks since midnight" use int 0x1A
with ah=0x00
. One second will be approximately 18 ticks. Be very careful with roll-over - if you're not careful and do "expiry_time = now + 1 second" just before midnight then you could be waiting forever, and you should do if(expiry_time >= 0x001800B0) expiry_time -= 0x001800B0
to prevent that.
If the OS is anything modern (Windows, OS X, Linux, FreeBSD, etc) then you want to tell the OS's scheduler to run other tasks for 1 second (to avoid hogging CPU time for no reason); and you'll either have to find the appropriate (OS specific) API to do that or find some sort of library to link against that does it for you.