SA-MP Forums Archive
Tag mismatch from CTime - 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: Tag mismatch from CTime (/showthread.php?tid=647729)



Tag mismatch from CTime - dicknyson - 09.01.2018

I'm using the CTime Library Plugin to represent unix timestamps as date and time. To make it a little easier and quicker, I made a function to do this:

Код:
CDate(timestamp, length)
{
	new tm <tmvar>;
	
	localtime(timestamp, tmvar); //Line causing the warning

	switch(length)
	{
		case LONG_DATE: strftime(datetmp, sizeof(datetmp), "%a %d %b, %Y at %H:%M", tmvar); //e.g. Tue 02 Jan, 2018 at 12:38
		case SHORT_DATE: strftime(datetmp, sizeof(datetmp), "%x at %H:%M", tmvar); //e.g. 02/01/2018 at 12:38 (dd/mm/yyyy)
		case JUSTTIME: strftime(datetmp, sizeof(datetmp), "%H:%M", tmvar); //e.g. 12:38
	}

	return datetmp;
}
This works perfectly. However, it seems that passing the "timestamp" argument through "localtime" causes a tag mismatch warning. I've tried everything I can think of and nothing gets rid of the warning. I could just ignore the warning because the code works fine but that just doesn't feel right. :P


Re: Tag mismatch from CTime - Misiur - 09.01.2018

If it works fine, just force the tag
pawn Код:
localtime(Time:timestamp, tmvar);