#!/usr/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause

bf_chip=$(bffamily --chip)

# Not necessary on BF4
if [ "$bf_chip" = "BlueField-4" ]; then
	exit 0
fi

# Read RTC time to trigger FW repair of invalid dates
if command -v hwclock >/dev/null 2>&1; then
	if command -v timeout >/dev/null 2>&1; then
		timeout 5 hwclock --show >/dev/null 2>&1
	else
		hwclock --show >/dev/null 2>&1
	fi
fi
