Repository navigation
Conversation
The TIME function (fn_timei()) divided clock() by CLK_TCK, the system tick rate. clock() counts in CLOCKS_PER_SEC units, which is the tick rate in NuttX today. Divide by CLOCKS_PER_SEC. The result does not change today, and stays correct if CLOCKS_PER_SEC changes. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
xiaoxiang781216
approved these changes
Oct 24, 2026
Contributor
|
let's ignore style error since the foreign code base don't follow nuttx style and ci error which is fixed by apache/nuttx#20949 instead wasting ci resource by retrigger. |
Contributor
@jerpelea what do you think can we do that or would that mess up backporting later on? :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
TIMEfunction of bas (fn_timei()ininterpreters/bas/bas_global.c) dividesclock()byCLK_TCK.CLK_TCKis the system tick rate, butclock()counts inCLOCKS_PER_SECunits. In NuttX both are the tick rate today, so the result is correct, but the code uses the wrong constant. This PR divides byCLOCKS_PER_SEC.This is the bas part of the
CLOCKS_PER_SECseries of the dev@ thread "[DISCUSS] Breaking change: make CLOCKS_PER_SEC 1000000" (https://lists.apache.org/thread/bqxry570g9t63j63zmk4c5l82lybtx4s). #3904 (step 1, the other apps) and apache/nuttx#20923 (step 2) are merged. This PR does not need either of them.Impact
None today. The object code does not change (see Testing). The result stays correct if
CLOCKS_PER_SECchanges. Not a breaking change.Testing
qemu-armv8a:nshwithCONFIG_INTERPRETERS_BAS=y, built with apps master and with this PR.bas_global.ocompared withobjdump -dr(code and relocations) andobjdump -s(all sections except debug information): the only difference is the line number of threeassert()calls after the change, because the new line break adds one line.fn_timei()and all data are the same. (The build needs-Wno-erroron master too:bas_statement.chas older-Werror=array-boundserrors with GCC 14.)Style check:
tools/checkpatch.sh -c -u -m -gchecks the whole ofbas_global.cand reports 1045 errors, the same number as on master. 1020 of them are mixed-case identifiers of the third-party bas code (for exampleValue_new_INTEGER()), which a whitespace commit cannot fix; the others are older alignment and brace errors. The changed lines add no error.