The mktime() is an inbuilt C++ function which converts the local calendar time to the time since epoch and returns the value as an object of type time_t.
time_t mktime( struct tm *time_ptr )
Parameters: The function accepts a mandatory parameter pointer time_ptr that points to a tm object structure which contains a calendar time whihc is to be converted.
Return Value: The function returns two type of values as described below:
- It returns the time since epoch as an object of type time_t if the parameter passed is a success.
- It returns -1 on failure.
Below program illustrates the mktime() function:
Tha Day on 18th June 2018 was Monday
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- div() function in C++
- fma() function in C++
- log() function in C++
- exp() function C++
- map rend() function in C++ STL
- map rbegin() function in C++ STL
- max() function for valarray in C++
- ios manipulators hex() function in C++
- ios manipulators oct() function in C++
- ios manipulators dec() function in C++
- ios manipulators right() function in C++
- isfinite() function in C++
- nearbyint() function in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.