Steps For Showing Current Time In Milliseconds In C Program
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.
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.
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.