Switched up the way time stamp formatting is done. Now tracked by an

enum for easier determination. Also changed graphing window to respect
"system clock" style timestamps and display them properly.
This commit is contained in:
Collin Kidder
2023-03-15 19:50:58 -04:00
parent 1e0cd3c14d
commit 39b43ebf38
9 changed files with 69 additions and 61 deletions
+23 -11
View File
@@ -10,14 +10,20 @@
#include <QRect>
//#include <QDesktopWidget>
enum TimeStyle
{
TS_SECONDS,
TS_MICROS,
TS_MILLIS,
TS_CLOCK
};
class Utility
{
public:
static bool decimalMode;
static bool secondsMode;
static bool millisMode;
static bool sysTimeMode;
static TimeStyle timeStyle;
static QString timeFormat;
//determines whether the window position is within any available screens. If it is not we default
@@ -153,15 +159,21 @@ public:
static QVariant formatTimestamp(uint64_t timestamp)
{
if (!sysTimeMode) {
if (millisMode) return (double)timestamp / 1000.0;
if (!secondsMode) return (unsigned long long)(timestamp);
else
{
return (double)timestamp / 1000000.0;
}
switch (timeStyle)
{
case TS_CLOCK:
return QDateTime::fromMSecsSinceEpoch(timestamp / 1000);
break;
case TS_MILLIS:
return (double)timestamp / 1000.0;
break;
case TS_MICROS:
return (unsigned long long)(timestamp);
break;
case TS_SECONDS:
return (double)timestamp / 1000000.0;
break;
}
else return QDateTime::fromMSecsSinceEpoch(timestamp / 1000);
}
//parses the input string to grab as much of it as possible while staying alpha numeric