What is a clock tick equal to in ctime??

Recommended Answers

All 2 Replies

Im guessing you mean in relation to realy time, you may want to use CLOCKS_PER_SEC to get things in terms of time and in terms of time to clocks for example divide clock()/CLOCKS_PER_SEC withh give you how many seconds, etc and if you want to wait for x seconds do seconds*CLOCKS_PER_SEC

Chris

What is a clock tick equal to in ctime??

The time_t type is an implementation-defined arithmetic type capable of representing times. Use difftime function to get the difference between two times of type time_t in seconds as a double value:

#include <time.h>
...
    time_t t;
    time(&t);
    printf("time_t step %f sec\n",difftime(t+1,t)); // time_t precision

As usually, it's equal to 1 sec (but it's not the language standard requirement).

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.