SA-MP Forums Archive
CTime problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CTime problem (/showthread.php?tid=418005)



CTime problem - gabyk - 23.02.2013

Hi, i use CTime plugin by ryder and i have a problem.

pawn Код:
stock A_DifferenceDate ( )
{
    if ( D_Completed ( ) == 0 ) {
        new tm <date1>,
            tm <date2>;
       
        date1 [ tm_sec  ] = A_LastSecond;
        date1 [ tm_min  ] = A_LastMinute;
        date1 [ tm_hour ] = A_LastHour;
        date1 [ tm_mday ] = A_LastDay;
        date1 [ tm_mon  ] = A_LastMonth;
        date1 [ tm_year ] = A_LastYear;

        date2 [ tm_sec  ] = A_BeforeSecond;
        date2 [ tm_min  ] = A_BeforeMinute;
        date2 [ tm_hour ] = A_BeforeHour;
        date2 [ tm_mday ] = A_BeforeDay;
        date2 [ tm_mon  ] = A_BeforeMonth;
        date2 [ tm_year ] = A_BeforeYear;

        new dif = difftime ( mktime ( date1 ), mktime ( date2 ) );
        return dif;
    } else return 2;
}
I had two errors: warning 213: tag mismatch at new dif = difftime ( mktime ( date1 ), mktime ( date2 ) );

I tryed to put Time:, don't work..
How i can fix this errors ?


Re: CTime problem - Misiur - 23.02.2013

difftime is used for Time tag, mktime returns normal numbers.

pawn Код:
new dif = difftime ( mktime ( date1 ), mktime ( date2 ) );
return dif;
//changes to
return mktime (date2) - mktime (date1);



Re: CTime problem - gabyk - 23.02.2013

Thank you, t.c