09.01.2018, 21:49
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:
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
Код:
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; }