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 stamp error for Windows #132

Open
leochan2009 opened this issue Jun 5, 2017 · 1 comment
Open

Time stamp error for Windows #132

leochan2009 opened this issue Jun 5, 2017 · 1 comment

Comments

@leochan2009
Copy link
Contributor

time stamp don't get updated, even the computer is made to sleep for a while.
See the commit:
leochan2009@e042cb4

And the CI build resultes:
https://ci.appveyor.com/project/openigtlink/openigtlink-wg8dx/build/1.0.145

@tokjun
Copy link
Contributor

tokjun commented Jun 5, 2017

The use of multiple TimeStamp class instances might have caused this issue.

clock() (high-res clock API for Windows) only gives time from CRT initialization, while gettimeofday() in Linux/Mac gives the time since the Unix epich (1/1/1970 00:00:00 UT). To make them compatible, the current implementation of TimeStamp reset the internal origin time stamp with a time stamp from time() with a resolution of second in the constructor, measure the time from the internal origin time stamp to the GetTime() call, and combine them. However, this does not work well when one tries to compare time stamps from two different class instances with a sub-second resolution, because the origin time stamps in the two instances are measured with a second resolution.

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