Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bugs
  • Category User Interface
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by christop - 2008-03-28
Last edited by linusnielsen - 2008-03-31

FS#8820 - Misformatted time in "Rockbox Info" screen when in 12-hour clock mode

As 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.

Closed by  linusnielsen
2008-03-31 07:38
Reason for closing:  Fixed
Additional comments about closing:  

Thanks for the report and the fix.

Not having this problem on the Sansa e200 w/r16890. Perhaps it’s caused by something besides the 12 hour clock setting?

It is still present in builds r16894, r16896, and r16898 (I tested all three for good measure). These three builds also seem to hang when I plug it into USB (apparently starting with some build after r16873), but that’s a bug for a different task.

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.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing