-
Notifications
You must be signed in to change notification settings - Fork 16
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
mktime invalid normalization #28
Comments
Fixed in 0cde62e. Still possible problem if days or hours cause a year change, so I am leaving this one open. |
This supersedes GH-28 as the problem exists on all platforms.
psh: fixed restore oryginal terminal settings
is it still a problem after recent time related changes? |
If so, it would be great to have automatic test for validation. |
Yes, it seems that the problem is fixed now. Tested libphoenix at 023e717
Result:
I'm working on automatic tests for libphoenix time functions: phoenix-rtos/phoenix-rtos-tests#255 so I'll try to add this as a test case. |
I believe this task reamains open because of other possibilities to year changes than month. Original normalisation issue was fixed here: I'm really grateful that you add this as test (as this kind of things are crucial and problems can be really painful) but I think proper test should also validate other cases. Please check #28 (comment) |
mktime incorrectly normalizes struct tm. When year is leap year and you normalize month interval, one day is lost.
eg.:
results with:
Tue Feb 1 06:00:00 2000
Wed Mar 1 06:00:00 2000
Sat Apr 1 06:00:00 2000
Mon May 1 06:00:00 2000
Thu Jun 1 06:00:00 2000
Sat Jul 1 06:00:00 2000
Tue Aug 1 06:00:00 2000
Fri Sep 1 06:00:00 2000
Sun Oct 1 06:00:00 2000
Wed Nov 1 06:00:00 2000
Fri Dec 1 06:00:00 2000
Sun Dec 31 06:00:00 2000
Tue Jan 30 06:00:00 2001
Fri Mar 2 06:00:00 2001
Mon Apr 2 06:00:00 2001
Wed May 2 06:00:00 2001
Sat Jun 2 06:00:00 2001
Mon Jul 2 06:00:00 2001
Thu Aug 2 06:00:00 2001
Sun Sep 2 06:00:00 2001
Tue Oct 2 06:00:00 2001
Fri Nov 2 06:00:00 2001
Sun Dec 2 06:00:00 2001
Wed Jan 2 06:00:00 2002
Sat Feb 2 06:00:00 2002
Sat Mar 2 06:00:00 2002
Tue Apr 2 06:00:00 2002
Thu May 2 06:00:00 2002
Sun Jun 2 06:00:00 2002
Tue Jul 2 06:00:00 2002
Fri Aug 2 06:00:00 2002
Mon Sep 2 06:00:00 2002
Wed Oct 2 06:00:00 2002
Sat Nov 2 06:00:00 2002
Mon Dec 2 06:00:00 2002
Thu Jan 2 06:00:00 2003
Sun Feb 2 06:00:00 2003
Sun Mar 2 06:00:00 2003
Wed Apr 2 06:00:00 2003
Fri May 2 06:00:00 2003
Mon Jun 2 06:00:00 2003
Wed Jul 2 06:00:00 2003
Sat Aug 2 06:00:00 2003
Tue Sep 2 06:00:00 2003
Thu Oct 2 06:00:00 2003
Sun Nov 2 06:00:00 2003
Tue Dec 2 06:00:00 2003
Fri Jan 2 06:00:00 2004
Mon Feb 2 06:00:00 2004
Tue Mar 2 06:00:00 2004
Fri Apr 2 06:00:00 2004
Sun May 2 06:00:00 2004
Wed Jun 2 06:00:00 2004
Fri Jul 2 06:00:00 2004
Mon Aug 2 06:00:00 2004
Thu Sep 2 06:00:00 2004
Sat Oct 2 06:00:00 2004
Tue Nov 2 06:00:00 2004
Thu Dec 2 06:00:00 2004
Sat Jan 1 06:00:00 2005
The text was updated successfully, but these errors were encountered: