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

incorrect results on dates before start-at #196

Closed
YSunLIN opened this issue Aug 4, 2019 · 4 comments

Comments

@YSunLIN
Copy link

commented Aug 4, 2019

I am working on the lastest commit 579b908, then I find something wrong on dates before start-at.
For example, before faking time, I get these results:

$ ls -alh /
...
drwxrwxrwt  43 root root  12K Aug  4 19:29 tmp
drwxr-xr-x  11 root root 4.0K Nov  4  2018 usr
drwxr-xr-x  13 root root 4.0K Nov  4  2018 var

After faking time, the dates before start-at are incorrect, like this

$ export FAKETIME="@2019-07-02 12:00:00"
$ ls -alh /
...
drwxrwxrwt  43 root root  12K Jul  2  2019 tmp
drwxr-xr-x  11 root root 4.0K Mar 31  2020 usr
drwxr-xr-x  13 root root 4.0K Mar 31  2020 var

And then, I do some research on why it happened. I find that commit 7bc0d50 causes the bug. When I revert this commit, it produces the correct results again.

@wolfcw wolfcw self-assigned this Aug 4, 2019

@wolfcw wolfcw added the confirmed label Aug 4, 2019

wolfcw pushed a commit that referenced this issue Aug 4, 2019

@wolfcw

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2019

Thanks for reporting this. Does fe42c2b change anything?

@YSunLIN

This comment has been minimized.

Copy link
Author

commented Aug 4, 2019

No. I don't know why commit 7bc0d50 can fix #190. However, negative tp is needed to adjust the dates before start-at.
I think maybe you should swap the branches, like this:

if(...){
    timespecsub(&ftpl_starttime.real, tp, &tdiff);  /* startup case? */
}
else {
    timespecsub(tp, &ftpl_starttime.real, &tdiff); /* regular case? */
}

wolfcw added a commit that referenced this issue Aug 4, 2019

@wolfcw

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2019

Should be fixed in 5e56e9a

@YSunLIN

This comment has been minimized.

Copy link
Author

commented Aug 4, 2019

Yes. It can be fixed like that. Thanks for your quick reply and support.

@wolfcw wolfcw closed this Aug 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.