/* #########################################
 * Traffic monitoring using Raspberry PI
 * Author: Michal Zacpal
 * Library: Base function
 * 2015
 * ######################################### */
#include "basefunctions.h"

/*
 * Function returns date &  time in chosen format
 */
QString GetSystemTime(int iFormat)
{
    QDateTime qTime = QDateTime::currentDateTime();
    QString qsTime;
    switch (iFormat){
    case 0: qsTime = qTime.toString(Qt::ISODate);break;    // YYYY-MM-DDTHH:MM:SSTZD
    case 1: qsTime = qTime.toString("hh:mm\tdd.MM.yyyy");break;    //hh:mm    DD.MM.YYYY
    case 2: qsTime = qTime.toString("hh:mm:ss\tdd.MM.yyyy");break;    //hh:mm:ss    DD.MM.YYYY
    case 3: qsTime = qTime.toString("yyyyMMdd");break;    //YYYYMMDD
    case 4: qsTime = qTime.toString("yyyyMMddThhmmsss");break;    //YYYYMMDDThhmmsss
    case 5: qTime.toString("yyyyMMdd-hh:mm:ss");break;    //YYYYMMDD-hh:mm:ss
    default: qTime.toString("yyyyMMdd-hh:mm:ss");break;    //YYYYMMDD-hh:mm:ss
    }
    return qsTime;
}

