kbw, thanks for the links, but i do not think they address my specific question. i want to use diff() to calculate the difference in time between 2 time_t objects. i think i am generating the first time_t object (i.e., the current time) correctly, however the second needs to be generated from a struct tm ('Birthday' in my case). i do intend to use mktime() to convert the struct tm to a time_t type, but there are 2 issues.
first, mktime() does not receive a struct tm, it receives a
pointer to a struct tm. if i just plug in the struct tm directly i get "error: cannot convert `tm' to `tm*' in assignment".
second, the struct tm is itself a member of the Rolodex structure i have defined. note i am dealing with an array of Rolodex structures, so i need to take this into account as well.
so my question is, how (if it is possible) do i point to a struct tm object that is a member of a defined
structure, which is, in turn, an element of an array? my best guess was
1 2 3 4
|
time_t ref;
struct tm *temp2;
temp2 = &(ptrEntry[1].Birthday);
ref = mktime(temp2);
|
but when i plug 'ref' into mktime(), mktime() returns -1. suggestions on the pointer syntax?