The following system constants are available at compile time. These can be useful in creating conditional code.
Example:
IMPORT STD;
STRING14 fGetDateTimeString() :=
#IF(__ECL_VERSION_MAJOR__ > 5) or ((__ECL_VERSION_MAJOR__ = 5) AND (__ECL_VERSION_MINOR__ >= 2))
STD.Date.SecondsToString(STD.Date.CurrentSeconds(true), '%Y%m%d%H%M%S');
#ELSE
FUNCTION
string14 fGetDimeTime():= // 14 characters returned
BEGINC++
#option action
struct tm localt; // localtime in "tm" structure
time_t timeinsecs; // variable to store time in secs
time(&timeinsecs);
localtime_r(&timeinsecs,&localt);
char temp[15];
strftime(temp , 15, "%Y%m%d%H%M%S", &localt); // Formats the localtime to YYYYMMDDhhmmss
strncpy(__result, temp, 14);
ENDC++;
RETURN fGetDimeTime();
END;
#END;
Runtime Expressions
The following system constants are evaluated at runtime. Technically, these are runtime expressions, not constants. Therefore, they cannot be used in conditional code that requires a constant.