Doxie Posted December 29, 2004 Share Posted December 29, 2004 I got this question from a friend, anyone able to help?I have 2 time values stored in tm structure. I need to know how many seconds are between. The only function for that seems to be difftime but it works with time_b values. Am i missing anything or is there really no library function that subtracts 2 values in tm format?I got no idea Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
SumTingWong Posted December 29, 2004 Share Posted December 29, 2004 (edited) I got this question from a friend, anyone able to help?I got no idea <{POST_SNAPBACK}>Use mktime to convert your tm structs to time_t values and then difftime to calculate the difference.mktime on MSDNUse gmtime or localtime to convert time_t value back to tm struct Edited December 29, 2004 by pacman Link to comment Share on other sites More sharing options...
Doxie Posted December 29, 2004 Author Share Posted December 29, 2004 His answer I know - I went through this some time ago already. This limits me to years between 1970 and somewhere around 2040. Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
SumTingWong Posted December 29, 2004 Share Posted December 29, 2004 His answer I know - I went through this some time ago already. This limits me to years between 1970 and somewhere around 2040.<{POST_SNAPBACK}>Why did he ask for a way to subtract between 2 tm values?If you want to go back further, use SYSTEMTIME which starts from January 1, 1601. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now