Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions TrafficMonitor/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,18 @@ ULONGLONG CCommon::GetCurrentTimeSinceEpochMilliseconds()
return millisecondsSince1970;
}

CString CCommon::GetSystemUpTimeString()
{
const ULONGLONG total_seconds{ GetTickCount64() / 1000 };
const int total_hours{ static_cast<int>(total_seconds / 3600) };
const int minutes{ static_cast<int>((total_seconds % 3600) / 60) };
const int seconds{ static_cast<int>(total_seconds % 60) };

CString up_time;
up_time.Format(LoadText(IDS_HOUR_MINUTE_SECOND), total_hours, minutes, seconds);
return up_time;
}

wstring CCommon::GetModuleDir()
{
wchar_t path[MAX_PATH];
Expand Down
3 changes: 3 additions & 0 deletions TrafficMonitor/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ class CCommon
//获取从1970年1月1日到现在的毫秒数
static ULONGLONG GetCurrentTimeSinceEpochMilliseconds();

//获取系统开机时长文本
static CString GetSystemUpTimeString();

//获取当前程序的目录
static wstring GetModuleDir();

Expand Down
3 changes: 3 additions & 0 deletions TrafficMonitor/TaskBarDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ CString CTaskBarDlg::GetMouseTipsInfo()
tip_info += temp;
}

temp.Format(_T("\r\n%s: %s"), CCommon::LoadText(IDS_SYSTEM_UPTIME), CCommon::GetSystemUpTimeString().GetString());
tip_info += temp;

//添加插件项目的鼠标提示
tip_info += theApp.GetPlauginTooltipInfo().c_str();

Expand Down
5 changes: 4 additions & 1 deletion TrafficMonitor/TrafficMonitorDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ CString CTrafficMonitorDlg::GetMouseTipsInfo()
{
temp.Format(_T("\r\n%s: %d %%"), CCommon::LoadText(IDS_HDD_USAGE), theApp.m_hdd_usage);
tip_info += temp;
}
}

temp.Format(_T("\r\n%s: %s"), CCommon::LoadText(IDS_SYSTEM_UPTIME), CCommon::GetSystemUpTimeString().GetString());
tip_info += temp;

//添加插件项目的鼠标提示
tip_info += theApp.GetPlauginTooltipInfo().c_str();
Expand Down
3 changes: 2 additions & 1 deletion TrafficMonitor/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#define IDS_BYTES_RECEIVED_SINCE_START L"IDS_BYTES_RECEIVED_SINCE_START"
#define IDS_BYTES_SENT_SINCE_START L"IDS_BYTES_SENT_SINCE_START"
#define IDS_PROGRAM_ELAPSED_TIME L"IDS_PROGRAM_ELAPSED_TIME"
#define IDS_SYSTEM_UPTIME L"IDS_SYSTEM_UPTIME"
#define IDS_HOUR_MINUTE_SECOND L"IDS_HOUR_MINUTE_SECOND"
#define IDS_INTERNET_IP_ADDRESS L"IDS_INTERNET_IP_ADDRESS"
#define IDS_GET_FAILED L"IDS_GET_FAILED"
Expand Down Expand Up @@ -221,4 +222,4 @@

#define TXT_OK L"TXT_OK"
#define TXT_CANCEL L"TXT_CANCEL"
#define TXT_CLOSE L"TXT_CLOSE"
#define TXT_CLOSE L"TXT_CLOSE"
1 change: 1 addition & 0 deletions TrafficMonitor/language/English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ IDS_BYTES_SENT = "Bytes sent"
IDS_BYTES_RECEIVED_SINCE_START= "Bytes received since the program start"
IDS_BYTES_SENT_SINCE_START= "Bytes sent since the program start"
IDS_PROGRAM_ELAPSED_TIME= "Program elapsed time"
IDS_SYSTEM_UPTIME= "System uptime"
IDS_HOUR_MINUTE_SECOND = "%d hours, %d minutes, %d seconds"
IDS_INTERNET_IP_ADDRESS= "Internet IP address"
IDS_GET_FAILED = "Get failed"
Expand Down
1 change: 1 addition & 0 deletions TrafficMonitor/language/Simplified_Chinese.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ IDS_BYTES_SENT = "已发送字节数"
IDS_BYTES_RECEIVED_SINCE_START= "自程序启动以来已接收字节数"
IDS_BYTES_SENT_SINCE_START= "自程序启动以来已发送字节数"
IDS_PROGRAM_ELAPSED_TIME= "程序已运行时间"
IDS_SYSTEM_UPTIME= "开机时长"
IDS_HOUR_MINUTE_SECOND = "%d小时%d分%d秒"
IDS_INTERNET_IP_ADDRESS= "外网IP地址"
IDS_GET_FAILED = "获取失败"
Expand Down
1 change: 1 addition & 0 deletions TrafficMonitor/language/Traditional_Chinese.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ IDS_BYTES_SENT = "已傳送的位元組數"
IDS_BYTES_RECEIVED_SINCE_START= "自程式啟動以來已接收位元組數"
IDS_BYTES_SENT_SINCE_START= "自程式啟動以來已傳送的位元組數"
IDS_PROGRAM_ELAPSED_TIME= "程式已執行時間"
IDS_SYSTEM_UPTIME= "開機時長"
IDS_HOUR_MINUTE_SECOND = "%d小時%d分%d秒"
IDS_INTERNET_IP_ADDRESS= "外網 IP 位址"
IDS_GET_FAILED = "取得失敗"
Expand Down