Base: apply clang format
This commit is contained in:
@@ -24,11 +24,11 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <QDateTime>
|
||||
# if defined(FC_OS_LINUX) || defined(__MINGW32__)
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
#include <sstream>
|
||||
#include <QDateTime>
|
||||
#if defined(FC_OS_LINUX) || defined(__MINGW32__)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "TimeInfo.h"
|
||||
@@ -58,7 +58,7 @@ TimeInfo::~TimeInfo() = default;
|
||||
|
||||
void TimeInfo::setCurrent()
|
||||
{
|
||||
#if defined (FC_OS_BSD) || defined(FC_OS_LINUX) || defined(__MINGW32__)
|
||||
#if defined(FC_OS_BSD) || defined(FC_OS_LINUX) || defined(__MINGW32__)
|
||||
struct timeval t;
|
||||
gettimeofday(&t, nullptr);
|
||||
timebuffer.time = t.tv_sec;
|
||||
@@ -66,29 +66,31 @@ void TimeInfo::setCurrent()
|
||||
#elif defined(FC_OS_WIN32)
|
||||
_ftime(&timebuffer);
|
||||
#else
|
||||
ftime(&timebuffer); // deprecated
|
||||
ftime(&timebuffer); // deprecated
|
||||
#endif
|
||||
}
|
||||
|
||||
void TimeInfo::setTime_t (int64_t seconds)
|
||||
void TimeInfo::setTime_t(int64_t seconds)
|
||||
{
|
||||
timebuffer.time = seconds;
|
||||
}
|
||||
|
||||
std::string TimeInfo::currentDateTimeString()
|
||||
{
|
||||
return QDateTime::currentDateTime().toTimeSpec(Qt::OffsetFromUTC)
|
||||
.toString(Qt::ISODate).toStdString();
|
||||
return QDateTime::currentDateTime()
|
||||
.toTimeSpec(Qt::OffsetFromUTC)
|
||||
.toString(Qt::ISODate)
|
||||
.toStdString();
|
||||
}
|
||||
|
||||
std::string TimeInfo::diffTime(const TimeInfo &timeStart,const TimeInfo &timeEnd )
|
||||
std::string TimeInfo::diffTime(const TimeInfo& timeStart, const TimeInfo& timeEnd)
|
||||
{
|
||||
std::stringstream str;
|
||||
str << diffTimeF(timeStart,timeEnd);
|
||||
return str.str();
|
||||
std::stringstream str;
|
||||
str << diffTimeF(timeStart, timeEnd);
|
||||
return str.str();
|
||||
}
|
||||
|
||||
float TimeInfo::diffTimeF(const TimeInfo &timeStart,const TimeInfo &timeEnd )
|
||||
float TimeInfo::diffTimeF(const TimeInfo& timeStart, const TimeInfo& timeEnd)
|
||||
{
|
||||
int64_t ds = int64_t(timeEnd.getSeconds() - timeStart.getSeconds());
|
||||
int dms = int(timeEnd.getMiliseconds()) - int(timeStart.getMiliseconds());
|
||||
|
||||
Reference in New Issue
Block a user