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

The time in event can be wrong. #3

Open
ppisl opened this issue Nov 19, 2019 · 3 comments
Open

The time in event can be wrong. #3

ppisl opened this issue Nov 19, 2019 · 3 comments
Assignees

Comments

@ppisl
Copy link
Collaborator

ppisl commented Nov 19, 2019

There is code in startBox.cpp and finishBox.cpp:

      unsigned long seconds = 10;
      unsigned long milliSeconds = 0;
      phone->getCurrentUnixTimeStamp(&seconds, &milliSeconds);
      int size = sprintf(cmd, "http://skimb.xelfi.cz/timing/add?when=%ld%d&type=START", seconds, milliSeconds);

The time can be wrong when milliSeconds < 100.

@jtulach
Copy link
Owner

jtulach commented Nov 19, 2019

The following code prints the milliseconds correctly:

    long sec = 10;
    long millis = 9;
    char buffer[256];
    snprintf(buffer, 256, "time: %d%03d", sec, millis);
    printf("%s\n", buffer);

@ppisl ppisl self-assigned this Nov 20, 2019
@ppisl
Copy link
Collaborator Author

ppisl commented Nov 20, 2019

It has to be :

snprintf(buffer, 256, "time: %ld%03d", sec, millis);

Seconds are long.

@jtulach
Copy link
Owner

jtulach commented Dec 1, 2019

Fine with me. Just provide the commit, please.

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