• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category User Interface → Themes
  • Assigned To No-one
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by lostlogic - 2005-12-23
Last edited by lostlogic - 2006-01-05

FS#2866 - add real time clock support to WPS

Patch adds RTC support to WPS. Format for time display
is user selectable.

%c starts time formatting. Any character other than
‘c’ or EOL is part of the format.

The following characters are supported for date
formatting (a subset of the unix date command):
case ‘d’: /* day of month (01..31) */
case ‘e’: /* day of month, blank padded ( 1..31) */
case ‘H’: /* hour (00..23) */
case ‘k’: /* hour ( 0..23) */
case ‘I’: /* hour (01..12) */
case ‘l’: /* hour ( 1..12) */
case ‘m’: /* month (01..12) */
case ‘M’: /* minute (00..59) */
case ‘S’: /* second (00..60) */
case ‘y’: /* last two digits of year (00..99) */
case ‘Y’: /* year (1970…) */
case ‘p’: /* upper case AM or PM indicator */
case ‘P’: /* lower case am or pm indicator */

Bugs: Only updates time every several seconds. This
appears to be how often the values supplied by
get_time() are updated. Is there another function that
should be used here? Would it be a bad idea to update
it more often, and should we therefore not support the
seconds tag?

Possible improvements that I don’t have a good idea on
how to make: Better termination of processing.
Relying on the wps writer to put the ending ‘c’ in is
rough. (only allow certain characters other than
flags?). Support for stringy month/day-of-week tags.

Closed by  lostlogic
2006-03-18 22:50
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

In CVS now

W00t, added short stringy names for day of week and month.
Still no better termination, and when I put it higher up on
the WPS the updates were happening every second. Not sure
what is up with that.

case ‘a’: /* abbreviated weekday name (Sun..Sat) */
case ‘b’: /* abbreviated month name (Jan..Dec) */

case ‘u’: /* day of week (1..7); 1 is Monday */
case ‘w’: /* day of week (0..6); 0 is Sunday */
added, and fixed a couple of lines that were too long.

It’s been suggested to split this up into a bunch of subtags
some (or all) of which have enumerated values. This could
be done, but would involve more structural changes to the
gwps-common.c file to prevent over-calling of get_time().
I’m inclined to prefer keeping this style, but even if it’s
decided to change it, it wouldn’t be that difficult to switch.

Anonymous Submitter commented on 2005-12-25 09:53


Anonymous Submitter commented on 2006-01-03 16:31

Dont manage to add it in my wps. Could you give a syntax

I use: %ca, b d, H:M:Sc

Minor change, use WPS_REFRESH_DYNAMIC flag so that it
updates right all the time.


Available keyboard shortcuts


Task Details

Task Editing