time()Prototype: time_t time(time_t* timer);Header File: time.h (C) or ctime (C++) ANSI: C and C++ Explanation: Returns and sets the passed in variable to the number of seconds that have passed since 00:00:00 GMT January 1, 1970. If NULL is passed in, it will work as if it accepted nothing and return the same value. Example:
//Program will use time_t to store number of seconds since 00:00:00 GMT
//Jan. 1, 1970
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
time_t hold_time;
hold_time=time(NULL);
cout<<"The number of elapsed seconds since Jan. 1, 1970 is "<<hold_time;
}
Other Functions
|