mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil, hal] Crash on failure for SetupNowRio() and wpi::Now() when not configured (#6417)
This is an unrecoverable condition, so always terminate.
This commit is contained in:
@@ -273,15 +273,14 @@ uint64_t wpi::Now() {
|
||||
if (nowUseDefaultOnFailure.test()) {
|
||||
return timestamp() - offset_val;
|
||||
} else {
|
||||
static uint64_t last = 0;
|
||||
uint64_t cur = timestamp();
|
||||
if ((cur - last) > 100000) {
|
||||
last = cur;
|
||||
fmt::print(stderr,
|
||||
"FPGA not yet configured in wpi::Now(). Time will not be "
|
||||
"correct.\n");
|
||||
std::fflush(stderr);
|
||||
}
|
||||
fmt::print(stderr,
|
||||
"FPGA not yet configured in wpi::Now(). This is a fatal "
|
||||
"error. The process is being terminated.\n");
|
||||
std::fflush(stderr);
|
||||
// Attempt to force a segfault to get a better java log
|
||||
*reinterpret_cast<int*>(0) = 0;
|
||||
// If that fails, terminate
|
||||
std::terminate();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user