New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use high resolution time for Timer::read(). #7975

Merged
merged 1 commit into from Oct 1, 2018

Conversation

Projects
None yet
6 participants
@tkem
Contributor

tkem commented Sep 3, 2018

Description

float Timer::read() delegates to Timer::read_us(), which returns an int, i.e. a signed 32-bit value capable of storing values up to 2147483647 us (the use of signed types in this interface has always bothered me, but that's outside the scope of this PR). Therefore, Timer::read() will return values up to ~2147.5f seconds, or 35.8 minutes, even though the float return type could represent a much higher range (3.402823e+38 seconds, at reduced precision, of course).

By contrast, int Timer::read_ms() returns read_high_resolution_us() / 1000, so the maximum (signed) value is 2147483647 ms, or more than 24 days (if I haven't made a mistake).

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change
@kjbracey-arm

I don't like the float return here, but if we have it, this is clearly a better implementation.

@pan-

pan- approved these changes Sep 4, 2018

@0xc0170

0xc0170 approved these changes Sep 4, 2018

@0xc0170 0xc0170 added the needs: CI label Sep 4, 2018

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 27, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Sep 27, 2018

Build : SUCCESS

Build number : 3177
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7975/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 27, 2018

/morph mbed2-build

@mbed-ci

This comment has been minimized.

@cmonr cmonr added ready for merge and removed needs: CI labels Sep 28, 2018

@0xc0170 0xc0170 merged commit 9b0e534 into ARMmbed:master Oct 1, 2018

14 checks passed

ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed , RTOS ROM(+0.0%) RAM(+0.0%)
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/cloud_client_smoke_test Test job: successful
Details
travis-ci/astyle Passed, 597 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9091 cycles (-1384 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8372B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details

@0xc0170 0xc0170 removed the ready for merge label Oct 1, 2018

@tkem tkem deleted the tkem:fix/timer-read-range branch Oct 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment