Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
1.16/5 (4 votes)
See more:
C#
void GetTime (tsTime *tt)
{
long lt;
struct tm tvar;
//struct tm *__cdecl localtime(const time_t *t);
    time_t(&lt);
    tvar = *localtime (&lt);
    tt->cHour = tvar.tm_hour;
    tt->cMinute = tvar.tm_min;
    tt->cSecond = tvar.tm_sec;
    return;
}

Its Showing
error C2040: 'lt' : 'time_t &' differs in levels of indirection from 'long'
error C2530: 'lt' : references must be initialized
HOW TO SOLVE THESE
Posted
Comments
Maciej Los 23-May-14 2:24am    
First of all, you need to know what above code does...
Secondly, you'll be able to 'convert' it.

1 solution

You should not use long for the lt variable; use time_t as that will then work for both 32 bit and 64 bit. See http://msdn.microsoft.com/en-us/library/1f4c8f33.aspx[^].
 
Share this answer
 
Comments
[no name] 23-May-14 4:07am    
5.
Maciej Los 23-May-14 6:00am    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900