Skip to content
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

time.ticks_diff and time.ticks_ms are undefined. #5

Open
nevercast opened this issue Nov 20, 2018 · 2 comments
Open

time.ticks_diff and time.ticks_ms are undefined. #5

nevercast opened this issue Nov 20, 2018 · 2 comments

Comments

@nevercast
Copy link

While effort has been made to support running outside of micropython, some non-standard functions are still used.

I've stubbed them like so:

import time
if not hasattr(time, 'ticks_ms'):
    ticks_ms = lambda : time.clock() * 1000.
else:
    ticks_ms = time.ticks_ms
if not hasattr(time, 'ticks_diff'):
    ticks_diff = lambda a, b: b - a
else:
    ticks_diff = time.ticks_diff

Then used ticks_diff() and ticks_ms() instead of time.ticks_diff() and time.ticks_ms() respectively.

I believe this is correct, you may want to verify ticks_diff's polarity.

@nickovs
Copy link
Owner

nickovs commented Nov 20, 2018

Thanks for the suggestion. As I mentioned in my first reply to #1 the main goal with slimDNS is minimal memory footprint when run on micropython, so I've been trying to avoid adding extra code like this. That said, if there is genuine interest in a version that runs on other platforms then I can look into it.

@nevercast
Copy link
Author

nevercast commented Nov 21, 2018

My primary motivation was the simplicity of the design (read: lightweight), being able to test on Windows would allow me to validate if its the right thing that I need, as well as use it to detect micropython devices asking the question part of the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants