FS#2866 - add real time clock support to WPS

Attached to Project: Rockbox
Opened by Brandon Low (lostlogic) - Friday, 23 December 2005, 05:29 GMT
Last edited by Brandon Low (lostlogic) - Thursday, 05 January 2006, 21:47 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


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.
This task depends upon

Closed by  Brandon Low (lostlogic)
Saturday, 18 March 2006, 22:50 GMT
Reason for closing:  Accepted
Additional comments about closing:  In CVS now
Comment by Brandon Low (lostlogic) - Friday, 23 December 2005, 06:50 GMT

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.
Comment by Brandon Low (lostlogic) - Friday, 23 December 2005, 06:53 GMT

case 'a': /* abbreviated weekday name (Sun..Sat) */
case 'b': /* abbreviated month name (Jan..Dec) */
Comment by Brandon Low (lostlogic) - Friday, 23 December 2005, 08:19 GMT

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.
Comment by Anonymous Submitter - Sunday, 25 December 2005, 09:53 GMT

Comment by Anonymous Submitter - Tuesday, 03 January 2006, 16:31 GMT

Dont manage to add it in my wps. Could you give a syntax
Comment by Brandon Low (lostlogic) - Tuesday, 03 January 2006, 16:56 GMT

I use: %ca, b d, H:M:Sc
Comment by Brandon Low (lostlogic) - Thursday, 05 January 2006, 21:46 GMT

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