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

Problem with using minuteChanged and secondChanged together #53

Closed
aussieW opened this issue Jun 22, 2019 · 2 comments
Closed

Problem with using minuteChanged and secondChanged together #53

aussieW opened this issue Jun 22, 2019 · 2 comments

Comments

@aussieW
Copy link

aussieW commented Jun 22, 2019

Hi

I am writing a program to display he time on an LED matrix. I used secondChanged to blink a colon between the hours and minutes and also manually tracked when the minute changed in order to update the time on the display. That worked fine.

I figured I could simplify things by using minuteChanged to trigger a screen refresh rather than tracking when the minute changed. However, when I use both minuteChanged and secondChanged together I find that secondChanged is being triggered approx 100,000 times per second rather than just once per second.

My questions are:

  1. should the combination of these two functions work as I expect, and there is a bug occurring?
  2. these two functions not designed to work together in the same program?

Thanks
aussieW

@ropg
Copy link
Owner

ropg commented Jun 22, 2019

You have to read the time using one of ezTime's functions (such as now()) for it to update _last_read_t, which is used internally to determine whether the seconds or minutes have changed since the last time the time was read. So just calling the function and then not reading the time when it returns true keeps it returning true. Just read the time with now() every time it has changed and you're fine.

@ropg ropg closed this as completed Jun 22, 2019
@aussieW
Copy link
Author

aussieW commented Jun 22, 2019

Thanks. Works great now.

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