Skip to content

Commit 42e6062

Browse files
fix: normalize estimation provenance timestamps [code:qws] [system:RC_GH200]
1 parent 36318da commit 42e6062

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

scripts/estimate_common.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ est_applicability_json=""
7575
est_confidence_json=""
7676
est_notes_json=""
7777

78+
_bk_normalize_estimation_timestamp() {
79+
local raw="${1:-}"
80+
81+
if [[ -z "$raw" ]]; then
82+
echo ""
83+
return 0
84+
fi
85+
86+
if [[ "$raw" =~ ^[0-9]{8}_[0-9]{6}$ ]]; then
87+
echo "${raw:0:4}-${raw:4:2}-${raw:6:2} ${raw:9:2}:${raw:11:2}:${raw:13:2}"
88+
return 0
89+
fi
90+
91+
echo "$raw"
92+
}
93+
7894
# ---------------------------------------------------------------------------
7995
# read_values — Read benchmark Result_JSON into global variables
8096
#
@@ -101,6 +117,7 @@ read_values() {
101117
# Read server-assigned uuid and timestamp (written back by send_results.sh)
102118
est_uuid=$(jq -r '._server_uuid // empty' "$json_file")
103119
est_timestamp=$(jq -r '._server_timestamp // empty' "$json_file")
120+
est_timestamp=$(_bk_normalize_estimation_timestamp "$est_timestamp")
104121

105122
# Fallback: read send_results manifest if the result JSON itself does not
106123
# carry the server-assigned metadata.
@@ -115,6 +132,7 @@ read_values() {
115132
fi
116133
if [[ -z "$est_timestamp" ]]; then
117134
est_timestamp=$(jq -r --arg file "$basename" '.[$file].timestamp // empty' "$meta_file")
135+
est_timestamp=$(_bk_normalize_estimation_timestamp "$est_timestamp")
118136
fi
119137
fi
120138
fi

0 commit comments

Comments
 (0)