Beispiel #1
0
long int operator - (const Fecha& f1, const Fecha& f2)
{
        // tm* f{};
        // f->tm_mday = f1.dia();
        // f->tm_mon = f1.mes();
        // f->tm_year = f1.anno();
        //
        // time_t tiempoilegible = mktime(f);
        // f = localtime(&tiempoilegible);
        //
        // long int f1d = f->tm_yday;
        //
        //
        // f->tm_mday = f2.dia();
        // f->tm_mon = f2.mes();
        // f->tm_year = f2.anno();
        //
        // tiempoilegible = mktime(f);
        // f = localtime(&tiempoilegible);
        //
        // long int f2d = f->tm_yday;
        //
        // return std::abs(f1d-f2d);
        tm sf1 = {0,0,0,f1.dia(),f1.mes()-1,f1.anno()-1900,0,0,0 };
	tm sf2 = {0,0,0,f2.dia(),f2.mes()-1,f2.anno()-1900,0,0,0 };
	long int tiempof1 = std::mktime(&sf1);
	long int tiempof2 = std::mktime(&sf2);

	return std::difftime(tiempof1,tiempof2)/86400;


}
Beispiel #2
0
bool operator < ( const Fecha& f1, const Fecha& f2)
{
        bool aux = false;

        if ( f1.anno() < f2.anno())
                aux =true;
        else if(f1.anno() == f2.anno() && f1.mes() < f2.mes())
                aux=true;
        else if( f1.mes() == f2.mes() && f1.dia()<f2.dia() )
                aux=true;

        return aux;

}
Beispiel #3
0
bool operator ==(const Fecha& f1, const Fecha& f2)
{
        return (f1.dia()==f2.dia() && f1.mes() && f2.mes() && f1.anno() ==f2.anno());
}
Beispiel #4
0
Fecha::Fecha(const Fecha& base, int delta) {
	_dia = base.dia();
	_mes = base.mes();
	_anyo = base.anyo();
}