VirtualBox

Ignore:
Timestamp:
Mar 21, 2014 12:13:29 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: show VM uptime in session information dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp

    r48260 r50841  
    4747#include "CNetworkAdapter.h"
    4848#include "CVRDEServerInfo.h"
     49
     50#include <iprt/time.h>
    4951
    5052#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    476478                          .arg (xOrigin)
    477479                          .arg (yOrigin);
     480        /* this page is refreshed every 5 seconds, round */
     481        uint32_t uUpSecs = (RTTimeProgramSecTS() / 5) * 5;
     482        char szUptime[32];
     483        uint32_t uUpDays = uUpSecs / (60 * 60 * 24);
     484        uUpSecs -= uUpDays * 60 * 60 * 24;
     485        uint32_t uUpHours = uUpSecs / (60 * 60);
     486        uUpSecs -= uUpHours * 60 * 60;
     487        uint32_t uUpMins  = uUpSecs / 60;
     488        uUpSecs -= uUpMins * 60;
     489        RTStrPrintf(szUptime, sizeof(szUptime), "%dd %02d:%02d:%02d",
     490                    uUpDays, uUpHours, uUpMins, uUpSecs);
     491        QString uptime = QString(szUptime);
    478492
    479493        QString clipboardMode = gpConverter->toString(m.GetClipboardMode());
     
    514528        /* Searching for longest string */
    515529        QStringList valuesList;
    516         valuesList << resolution << virtualization << nested << unrestricted << addVersionStr << osType << vrdeInfo;
     530        valuesList << resolution << uptime << virtualization << nested << unrestricted << addVersionStr << osType << vrdeInfo;
    517531        int maxLength = 0;
    518532        foreach (const QString &value, valuesList)
     
    522536        result += hdrRow.arg (":/state_running_16px.png").arg (tr ("Runtime Attributes"));
    523537        result += formatValue (tr ("Screen Resolution"), resolution, maxLength);
     538        result += formatValue (tr ("VM Uptime"), uptime, maxLength);
    524539        result += formatValue (tr ("Clipboard Mode"), clipboardMode, maxLength);
    525540        result += formatValue (tr ("Drag'n'Drop Mode"), dragAndDropMode, maxLength);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette