C Standard Libraries C++

time()

Declaration

time_t time(time_t* qpTime);

Description

This function returns the number of seconds elapsed since midnight January 1, 1970. The value is returned in both the return value and the value pointed to by the "qpTime" argument.

Example

#include <iostream>
#include <ctime>

int main() {
    using namespace std;

    time_t qTime;
    cout << "Seconds since midnight January 1, 1970 = " <<
        time(&qTime) << endl;

    return 0;
}

Output

time() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.