Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
TIPCommon.smp_time
TIPCommon.smp_time 模組提供全方位的工具,可處理整合中的時間資料。這項功能可簡化複雜的工作,例如時區轉換、連接器的時間戳記持續性,以及偵測動作和連接器中即將發生的執行逾時情況的重要監控功能。
時間轉換和操控
這些公用程式提供標準化方法,可在各種格式之間轉換時間資料,包括 Unix 時間戳記、RFC 3339 字串和 Python datetime 物件。
| 函式 |
參數 |
說明 |
change_timezone() |
dtime:(datetime) 來源物件。
current_tz:(str) 目前的時區名稱。
new_tz:(str) 目標時區名稱。
|
傳回:datetime.datetime
將 datetime 物件移至新的時區。如果任一時區字串無效,則會引發 ValueError。 |
convert_string_to_timestamp() |
datetime_string:(str) 來源字串。
|
傳回:int
剖析日期時間字串,並傳回對應的 Unix 時間戳記。 |
datetime_to_rfc3339() |
datetime_obj:(datetime) 來源物件。
|
傳回:str
將 datetime 物件轉換為符合 RFC 3339 規範的字串。 |
get_timestamps() |
range_string:(str) 已命名的時間範圍。
start_time_string:(字串) 開始界限。
end_time_string:(str) 結尾界線。
error_message:(str) 自訂例外狀況文字。
time_in_milliseconds:(bool) 預設為 False。
|
傳回:tuple[int, int]
根據範圍說明和界限字串,計算開始和結束的 Unix 時間戳記。 |
get_timestamps_from_range() |
range_string:(str) 已命名的平台範圍。
include_timezone:(bool) 如果 True,則包含時區資訊。
|
傳回:tuple[datetime, datetime]
計算從平台專屬時間範圍字串衍生的開始和結束日期時間物件。 |
狀態和持續性
持續記錄「上次執行時間」對連接器來說至關重要,可避免重複擷取資料。這些函式會直接與平台介面互動,管理執行檢查點。
| 函式 |
參數 |
說明 |
get_last_success_time() |
siemplify:(ChronicleSOAR) SDK 執行個體。
offset_with_metric:(dict) 備用位移。
time_format:(int) DATETIME (1) 或 UNIX (2)。
print_value:(bool) 如果
True,則記錄到控制台。
microtime:(bool) 精確度切換。
|
傳回:time (DataModel)
擷取上次成功執行的時間。如果沒有,系統會根據偏移量計算備用值。 |
save_timestamp() |
siemplify:(ChronicleSOAR) SDK 執行個體。
alerts:(字典) 處理過的快訊批次。
timestamp_key:(str) 預設為 'timestamp'。
incrementation_value:(int) 要加到結果的毫秒數。
log_timestamp:(bool) 如果
True,則記錄到控制台。
convert_timestamp_to_micro_time:(bool) 切換。
convert_a_string_timestamp_to_unix:(bool) 切換。
|
傳回:bool
找出快訊批次中的最新時間戳記並儲存。如果狀態已更新,則傳回 True。 |
siemplify_fetch_timestamp() |
siemplify:(ChronicleSOAR) SDK 執行個體。
datetime_format:(bool) 物件傳回的切換選項。
timezone:(bool) 如果 True 為 true,則強制使用 UTC。
|
傳回:int | datetime
直接從平台資料庫擷取目前的執行檢查點。 |
siemplify_save_timestamp() |
siemplify:(ChronicleSOAR) SDK 執行個體。
new_timestamp:(int) 要儲存的值。
datetime_format:(bool) 預設為 False。
timezone:(bool) 預設為 False。
|
傳回:None
使用特定新值更新平台的執行檢查點。 |
validate_timestamp() |
last_run_timestamp:(datetime) 檢查值。
offset_in_hours:(int) 最長回溯期。
offset_is_in_days:(bool) 以天為單位的邏輯切換開關。
|
傳回:datetime
確保時間戳記在允許的範圍內。如果超出範圍,則會引發 ValueError。 |
執行監控
逾時監控是重要的安全功能,這些函式可協助指令碼判斷處理時間即將用盡,以便正常停止並儲存目前狀態。
| 函式 |
參數 |
說明 |
is_approaching_action_timeout() |
action_execution_deadline_in_unix:(int) 截止日期。
timeout_threshold_in_sec:(int) 緩衝區。預設值為 10。
|
傳回:bool
檢查動作指令碼是否在終止前的最終緩衝區間內。 |
is_approaching_timeout() |
connector_starting_time:(int) 開始時間。
python_process_timeout:(int) 時間長度上限。
timeout_threshold: (float) 0.9
(TIMEOUT_THRESHOLD)。
|
傳回:bool
根據 90% 的時間預算,偵測連接器是否已耗盡時間預算。TIMEOUT_THRESHOLD |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-09-16 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-09-16 (世界標準時間)。"],[],[]]