Jump to content

Recommended Posts

Posted

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 :idiot:

Were ever i lay my script is my home...

Posted (edited)

I got this question from a friend, anyone able to help?

I got no idea :idiot:

<{POST_SNAPBACK}>

Use mktime to convert your tm structs to time_t values and then difftime to calculate the difference.

mktime on MSDN

Use gmtime or localtime to convert time_t value back to tm struct

Edited by pacman
Posted

His answer :idiot:

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...

Posted

His answer :idiot:

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...