Link to home
Start Free TrialLog in
Avatar of rian
rian

asked on

NT Timer Routine

I am trying to write a C++ console program running in NT Server-DOS process which would be able to do a countdown of time defined by the user as well as exit the countdown based on the user input. The current program takes a lot of system CPU resource to countdown to a pre-determined time interval. DOes WIN32 provide an API which will return time without eating the CPU resource.
ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rian
rian

ASKER

Apparantly, the Sleep function does not work on a console application. Is that true
That is NOT true. I have written console applications that use Sleep. The console applications have access to most of the Win32 API.

Avatar of rian

ASKER

I do not dispute what u are saying. Unfortunately, I have not been able to compile with the sleep API. I have included windows.h, winbase.h. Also, added Kernel32 in the link lib setting.

Could u tell me which header file is required to compile. Currently, the compiler tells me that sleep in a unknown identifier.
All you need is winbase.h. Make sure you are using Sleep() and not sleep().