Steps For Showing Current Time In Milliseconds In C Program

Asked By 0 points N/A Posted on -
qa-featured

I want to write a program in C language to display the current time in milliseconds. What should be the basic logic behind writing this code? Please reply asap.

SHARE
Answered By 0 points N/A #305576

Steps For Showing Current Time In Milliseconds In C Program

qa-featured

The program involves the use of gettimeofday( ) function present as an in-built library function. For this, you need to include a time.h header file. This function is very precise and gives the time in milliseconds. You can also use the time( ) function, but it is less precise. These functions are more efficient in Linux based systems as compared to Windows based system. A similar function System.current .TimeMIlis( ) is available for Java users. But there is one constraint to the use of these functions. The time that is displayed is usually the CPU time. For these functions to display the accurate time, the CPU time must be adjusted accordingly. The code is shown below.

Related Questions