I want to convert a given time into epoch(time_t) and vice versa. can anyone tell what is the routine or algorithm for this?
Thanks
Update>
You should cast it to a long int instead of int.
long int
int
long int t = static_cast time(NULL);
An int might not be enough to hold the time, for example, on my platform, time_t is a typedef of __int64.
time_t
typedef
__int64