can someone tell me, how time limit is calculated in codechef.
The time limit is not calculated! Time limit refers to the time taken by your code to execute and produce right, wrong or no answer!
The time limit for each run of input data is given in the problem specification in the details box near the bottom of the page. 1 second is typical for many of the problems. This value is adjusted for which language is being used as per this blog post (link).
There is another blog post (link) with a few more remarks on this. To quote:
our definition of Time Limit: It is the time in which your program must read, process, and output the result of an input test file.