我認爲你有正確的想法,也並不似乎是一個非常簡潔的方式(在TACL)獲取進程的創建時間,所以你必須處理狀態命令的輸出。這並不需要一個變量作爲OUTV參數,所以你可以使用一個文件,並在那裏做一些處理,而不是在TACL中。
我轉換兩個時間戳來的空間分隔的列表,#CONTIME給出,然後將其轉化到那些儒略時間戳(見下文)。
這可能是更容易的(說)C,在那裏你可以打電話PROCESS_GETINFOLIST_直接拿到創建時間戳做。在OSS shell中執行它可能更容易,因爲它可以更好地處理那裏的時間戳。
?TACL ROUTINE
#FRAME
#PUSH tempfile
#SET tempfile XXTEMPXX
[#DEF MakeTimeList ROUTINE |BODY|
#FRAME
#PUSH month day year time hour min sec centi milli
SINK [#ARGUMENT/VALUE month/WORD]
SINK [#ARGUMENT/VALUE day/WORD]
SINK [#ARGUMENT COMMA]
SINK [#ARGUMENT/VALUE year/NUMBER]
SINK [#ARGUMENT/VALUE hour/NUMBER]
SINK [#ARGUMENT/VALUE min/NUMBER]
SINK [#ARGUMENT/VALUE sec/NUMBER]
SINK [#ARGUMENT/VALUE centi/NUMBER]
[#CASE [month]
|January| #SET month 1
|February| #SET month 2
|March| #SET month 3
|April| #SET month 4
|May| #SET month 5
|June| #SET month 6
|July| #SET month 7
|August| #SET month 8
|September| #SET month 9
|October| #SET month 10
|November| #SET month 11
|December| #SET month 12
]
#SET milli [#CHARGET centi 4 TO 6]
#SET centi [#CHARGET centi 1 TO 3]
#RESULT [year] [month] [day] [hour] [min] [sec] [centi] [milli]
#UNFRAME
]
#PUSH start now lines line pos process
SINK [#ARGUMENT/VALUE process/ PROCESSNAME]
[#IF NOT [#PROCESSEXISTS [process]] |THEN|
#OUTPUT [process] does not exist
]
status/out [tempfile]/[process],detail
edit [tempfile];cqab/:/ /a;cqab/./ /a;exit
filetovar [tempfile] lines
SINK [#PURGE [tempfile]]
#SET pos [#LINEFIND lines 1 Process Creation Time]
[#IF pos > 1 |THEN|
#SET line [#LINEGET lines [pos]]
#SET start [#CHARGET line 23 TO [#CHARCOUNT line]]
#SET start [MakeTimeList [start]]
#SETMANY start, [#COMPUTETIMESTAMP [start] ]
#SETMANY now, [#COMPUTETIMESTAMP [#CONTIME [#TIMESTAMP]] 0]
#OUTPUT [#COMPUTE ([now] - [start])/1000000] seconds have elapsed
]
#UNFRAME