-
Notifications
You must be signed in to change notification settings - Fork 272
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
TimesStatusPanel: Cut seconds of for the final flight time calculation. #1027
base: master
Are you sure you want to change the base?
Conversation
RoughTime rough_takeoff_time = RoughTime::FromSinceMidnight(flight.takeoff_time); | ||
RoughTime rough_landing_time = RoughTime::FromSinceMidnight(flight.landing_time); | ||
SetText(FlightTime, FormatSignedTimeHHMM(FloatDuration(rough_landing_time-rough_takeoff_time))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this robust against midnight rollover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not robust against midnight rollover. One mistake is your new FromSinceMidnight()
implementation, and in general your use of class RoughTime
. That class cannot have values beyond 24 hours. Therefore, you cannot use it to calculate time stamps which may have exceeded to the next day (which is very common in certain time zones).
Your code is not only complicated and slow, but also wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was uncertain myself if that will be 24h rollover safe and tested it. The outcome with the igc replay was positive. Starting one day landing the next day is handled correctly.
Generally I was also not happy to see this limitation in the time stamp implementation serving as a time base for xcs. But that is worth a discussion. Will kick this off.
Thank you, Max, for reviewing carefully.
Yes it is.
takeoff_time is of type TimeStamp that is rollover hard, FromSinceMidnight
uses the plain constructor of RoughTime
, which does allow >24h values.
There should actually no time container that is limited to 24h in XCS.
Am 29.08.22 um 09:59 schrieb Max Kellermann:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In src/Dialogs/StatusPanels/TimesStatusPanel.cpp
<#1027 (comment)>:
> + RoughTime rough_takeoff_time = RoughTime::FromSinceMidnight(flight.takeoff_time);
+ RoughTime rough_landing_time = RoughTime::FromSinceMidnight(flight.landing_time);
+ SetText(FlightTime, FormatSignedTimeHHMM(FloatDuration(rough_landing_time-rough_takeoff_time)));
Is this robust against midnight rollover?
—
Reply to this email directly, view it on GitHub
<#1027 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADFKNMLEOJMQWORVHFSWC3V3RUVBANCNFSM57345MOA>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Helmut Rohs
t: +49 761 887 990 24
m: +49 151 250 505 44
|
But there is. The API contract of The whole roundtrip from We could, of course, change the API contract of |
Ok Max. What I expect from a positively executed review is a indication to a favoured solution instead of just the statement: I dont like the way you did it.
|
Finding good solutions for software problems is hard. You made mistakes (everybody makes mistakes, no big deal), but these mistakes are not about my taste or my preference. You violated the documented API contract of Note that inferior performance is also not about taste; that can be proven. Inferior performance is not necessarily an obstacle for merging. But in my taste, unnecessary performance degradation should be improved. In this case, the bad performance of your code was unnecessary and your (unconscious) choice. Improving one's code until it is good enough is the normal lifecycle of a PR. What you never see is how long it takes me to polish my patches before they are ready for merging, because (unfortunately!) nobody reviews my contributions, and therefore I never submit my contributions as PRs. Some patches are trivial, but many patches are so hard to develop, I amend them dozens of times before they are good enough, and sometimes that takes weeks or months. Never give up!
I already explained two reasons why I believe this is a bad solution.
What does this method do, and how does it solve the problem?
If by "few lines" you mean have redundant code - then no.
Why do you believe that having some I suggest:
|
closes #957