![]() |
[quote=cheesehead;149179]Doesn't your example show that at 10:30 am, the night setting is used by v24?[/quote]
Yes. [quote=cheesehead;149179]That's the same as v25 does. After exchanging day start and end times, it exchanges day and night memory allocations. Thus, at 10:30 am, v25 will consider it to be "day"time, and so will then use the memory allocation that the user originally specified for night, which had been exchanged into the "day" allocation slot.[/quote] Hm, yes, but it does it by doing something the user doesn't expect. That might mean that settings don't get set correctly due to what would be called user error but is the product of a bad design (if the user sets the memory first or notices Prime95 reversed the times, it should work, but if the user sets the time, then sets the memory without noticing that it reversed, the user's day/night memory will be reversed, as probably happened to the OP). |
[quote=Mini-Geek;149191]if the user sets the time, then sets the memory without noticing that it reversed, the user's day/night memory will be reversed, as probably happened to the OP).[/quote]I see ... that's not good. If the user's setting were not changed, it wouldn't matter what somersaults were performed internally, but the UI shouldn't mess around.
|
A better approach would be to have an hour by hour setting so you could define any hour as a "daytime" hour. Then it would not matter if you wrapped around midnight or not.
DarJones |
I agree that the present code "works" by flipping both the hours and the memory settings. V24 did not do this (it had 4 different INI file settings). V25 does (it has one setting: Memory=amount1 during time1-time2 else amount2). The bug was introduced in v25 converting the 4 ini settings or 4 values input in the dialog box to the new during/else syntax.
Ugh. I suppose the correct solution is to write out your example settings as: Memory=dayvalue during 10:30-24:00 else dayvalue during 00:00-01:30 else nightvalue Of course, I then need to parse that for the dialog box. |
you turning into an indian george? or is that as ugly to you as it is to me.
DarJones |
Is there anything wrong with this pseudocode? (besides ugly indenting):
[code] [B]if( ([/B]dayStart [B]<[/B] dayEnd [B]and[/B] now [B]>=[/B] dayStart [B]and[/B] now [B]< [/B]dayEnd[B])[/B] [B]or[/B] [B]([/B]dayStart [B]>[/B] dayEnd [B]and[/B] [B]([/B]now [B]>=[/B] dayStart [B]or[/B] now [B]<[/B] dayEnd[B]) ) ) [/B] [B]{[/B] day [B]=[/B] true[B];[/B] [B]} else {[/B] day [B]=[/B] false[B];[/B] [B]}[/B] [/code]That should handle any case whether the day spans across midnight or not, with only one range setting. |
Oh and, by "now" I mean "time elapsed since midnight".
|
I would prefer:
[CODE] DM = 24*60; day = (DM + now - dayEnd) % DM > (DM + dayStart - dayEnd) % DM; [/CODE] all times in minutes past midnight. Jörg p.s. I hope I didn't made a mistake.... |
[quote=Phantomas;150297][code]
DM = 24*60; day = (DM + now - dayEnd) % DM > (DM + dayStart - dayEnd) % DM; [/code]all times in minutes past midnight.[/quote] The DM term is redundant, since you are calculating mod DM: [code] day = (now - dayEnd) % DM > (dayStart - dayEnd) % DM; [/code] |
[quote=jrk;150304]The DM term is redundant, since you are calculating mod DM:
[code] day = (now - dayEnd) % DM > (dayStart - dayEnd) % DM; [/code][/quote] Yes, but as far as I remember there where, at least in the past, different implementations of the modulo operator in case of negativ parameters. mod(-7,10) can result in -7 or +3. So it would be compiler dependent if it works or not. |
| All times are UTC. The time now is 10:29. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.