modTime 函式庫 風禹科技驗證有限公司 網站 提供 .Net 原始碼

MyGetSystemTimes 函數

說明

取得系統閒置時間

本函數之引數列表

引數 型態 位元組 選項 預設值 說明
nFlags enuCPUTimes 4 可省略 IdleTime Or Seconds 取得之時間,在本函數中 CreationTime, ExitTime 不作用。列舉常數為:
常數名 數值 說明
CreationTime 0 建立時間,真實時間
ExitTime 1 結束時間,真實時間
KernelTime 2 核心時間,從建立時間開始起算
UserTime 3 使用者時間,從建立時間開始起算
CPUTime 4 CPU 時間,同工作管理員處理程序內之時間
IdleTime 1 CPU 閒置時間,同工作管理員處理程序內 System Idle Process 之 CPU 時間
VariantDate 0 傳回 VB 之 Variant Date
Ticks 65536 傳回總 Ticks 值,100 奈秒 (1/10000000 秒)
Milliseconds 131072 傳回總毫秒數,Variant Double
Seconds 262144 傳回總秒數,Variant Double
Minutes 524288 傳回總分鐘數,Variant Double
Hours 1048576 傳回總小時數,Variant Double
Days 2097152 傳回總天數,Variant Double

傳回值

依設定選項傳回 Date 或 Double

範例

Debug.Print MyGetSystemTimes
 370555.9375 
Debug.Print MyGetSystemTimes(IdleTime)
1900/1/3 上午 06:52:22

更進一步

  本函數可取得系統時間,預設取得系統閒置時間 (System Idle Process) ,若需取得 System CPU 時間,請改用 GetProcessTimes ,若指定傳回項目無值時,傳回 0, FileTime 型別以 1601/01/01 00:00:00 為時間原點。

基本條件

Visual Basic 4 以後 | GetProcessTimes | modTime.bas

請參閱

modTime 函式庫