How do I cast a time_t value to int, correctly?![]()
This is a discussion on cast from time_t to int within the C++ Programming forums, part of the General Programming Boards category; How do I cast a time_t value to int, correctly?...
How do I cast a time_t value to int, correctly?![]()
http://livebad.com/nuka
Da-Nuka
or.. will casting be enough?
Or do I need to call something like a convert-function?![]()
http://livebad.com/nuka
Da-Nuka
The Microsoft libraries use a long int for time_t, so this cast ought not to cause problems.Code:time_t the_time; // declare a time_t variable long int x; // declare a long int the_time = time(0); // initialize the time_t variable with the system time x = static_cast<int> the_time; // case the time_t variable to a long int
Last edited by joshdick; 04-06-2005 at 07:41 AM.