Example #1
0
/*
 * Get build date
 */
QDate mixp_get_build_date(void)
{
	QDate buildDate(2000, 1, 1);

	static const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

	int date[3] = {0, 0, 0}; char temp[12] = {'\0'};
	strncpy_s(temp, 12, mixp_buildDate, _TRUNCATE);

	if(strlen(temp) == 11)
	{
		temp[3] = temp[6] = '\0';
		date[2] = atoi(&temp[4]);
		date[0] = atoi(&temp[7]);
			
		for(int j = 0; j < 12; j++)
		{
			if(!_strcmpi(&temp[0], months[j]))
			{
				date[1] = j+1;
				break;
			}
		}

		buildDate = QDate(date[0], date[1], date[2]);
	}

	return buildDate;
}
Example #2
0
/*!
    \brief Returns the build date as a localized string, e.g. "9. Februar 2009". If
    there was some kind of error, the returned string is empty.
 */
QString getBuildDate() {
    QStringList monthNames;
    QString buildDateString = "";

    monthNames << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dez";
    QStringList buildDateStringList = QString(__DATE__).simplified().split(' '); // __DATE__ returns eg "Feb  4 2009"

    if ( buildDateStringList.count() == 3 ) {
        QDate buildDate(buildDateStringList.last().toInt(), monthNames.indexOf( buildDateStringList.first() )+1, buildDateStringList.at(1).toInt());
        buildDateString = buildDate.toString("d. MMMM yyyy");
    }

    return buildDateString;
}
	TITANIUM_PROPERTY_GETTER(TiModule, buildDate)
	{
		return get_context().CreateString(buildDate());
	}