This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#8820 - Misformatted time in "Rockbox Info" screen when in 12-hour clock mode
Attached to Project:
Rockbox
Opened by Christopher Williams (christop) - Friday, 28 March 2008, 21:15 GMT+2
Last edited by Linus Nielsen Feltzing (linusnielsen) - Monday, 31 March 2008, 09:38 GMT+2
Opened by Christopher Williams (christop) - Friday, 28 March 2008, 21:15 GMT+2
Last edited by Linus Nielsen Feltzing (linusnielsen) - Monday, 31 March 2008, 09:38 GMT+2
|
DetailsAs of today's build (r16867-080328), the Main Menu / System / Rockbox Info screen shows a misformatted time when the Time Format is set to "12 Hour Clock" (global_settings.timeformat != 0). The hour goes negative in the morning, and the hour at noon is 0. For example, when the time is 9 am, it displays "-3:00:00 A", and when it is 12 pm (noon), the info screen displays "00:00:00 P".
This is caused by a small logic/arithmetic error in apps/menus/main_menu.c. This small patch should fix the format of the hour in 12-hour mode. |
This task depends upon
Closed by Linus Nielsen Feltzing (linusnielsen)
Monday, 31 March 2008, 09:38 GMT+2
Reason for closing: Fixed
Additional comments about closing: Thanks for the report and the fix.
Monday, 31 March 2008, 09:38 GMT+2
Reason for closing: Fixed
Additional comments about closing: Thanks for the report and the fix.
Are you sure you're looking at the System / Rockbox Info screen during the range of times I described (particularly in the AM)? That's the only place I've seen this bug occur. It doesn't show up in the status bar line at the top.
The source file /apps/menus/main_menu.c is the only one that I found which might be the culprit (it's one of the only files that matches the regex "%.*d:%.*d:%.*d %"), and the logic in the original code seems wrong to me:
global_settings.timeformat == 0 ? tm->tm_hour : tm->tm_hour-12
When timeformat is non-zero (ie, 12-hour clock mode), this code subtracts 12 from the hour, whether the hour is greater than 12 or not. Note that tm->tm_hour is always in the range [0, 23], even in 12-hour mode. This changes the range of hours to -[12, 11], so the formatted string gets a zero or negative value when the hour is 12 or less.
It may be possible that it's caused by something besides the 12-hour clock setting, but I don't see how anything else could affect it, given how simple that line of code (above) is.