:lol: hello
i want to show the time in a certain program in part of seconds but i don't know,can you help me in solve this problem?
thanks

The function clock() in time.h or ctime returns the number of ticks since "process start". A tick is about a millisecond.

:lol: hello
i want to show the time in a certain program in part of seconds but i don't know,can you help me in solve this problem?
thanks

What is the language you are using? Is it a console program or a GUI program?

What is the language you are using? Is it a console program or a GUI program?

i use C++

console

Then the function std::clock() and the class std::clock_t can be used.

#include <ctime>
std::clock_t start_time = std::clock();
//Do something
std::clock_t time_passed = std::clock() - start_time;
std::cout << "time = " << time_passed;

edit:
convert this to seconds by using the CLOCKS_PER_SEC macro. you get the above in clock ticks. It is approximately a millisecond.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.