Here unsigned long EVTime::seconds()
method is conflicting with ptime p(d,seconds(s));
. If I change ptime seconds(s)
to minutes/hours then it works fine.
If i change that seconds(s)
to minutes(s)
or hours(s)
then only it will work. I am new to C++, anyone please help to resolve this conflict.
evt.cpp:
unsigned long EVTime::seconds()
{
ptime t(date(1901,Jan,1),time_duration(0,0,0));
time_duration td = utcdatetime - t;
return (unsigned long)td.total_seconds();
}
EVTime::EVTime(unsigned long s)
{
date d(1901,1,1);
ptime p(d,seconds(s));
utcdatetime=p;
}
evt.h:
class EVTime
{
public:
EVTime(unsigned long s);
unsigned long seconds();
ptime utcdatetime;
};
main.cpp:
int main()
{
EVTime t(222l);
cout<<"seconds since 1901: "<<t.seconds()<<endl;
}
Error code:
evtime.cpp: In constructor ‘EVTime::EVTime(long unsigned int)’:
evtime.cpp:35: error: no matching function for call to ‘EVTime::seconds(long
unsigned int&)’
evtime.cpp:14: note: candidates are: long unsigned int EVTime::seconds()