diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-02-05 23:58:53 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-02-05 23:58:53 +0000 |
| commit | 5513c30e34569d64f5b923b0aeaeea9ef55a0119 (patch) | |
| tree | fde9cc2f93435f26da319b9097111e959fa98d9e | |
| parent | a70d602f7d445cc7ffa06ba8035957e495f8c8bf (diff) | |
| download | rockbox-5513c30e34569d64f5b923b0aeaeea9ef55a0119.zip rockbox-5513c30e34569d64f5b923b0aeaeea9ef55a0119.tar.gz rockbox-5513c30e34569d64f5b923b0aeaeea9ef55a0119.tar.bz2 rockbox-5513c30e34569d64f5b923b0aeaeea9ef55a0119.tar.xz | |
make all the RTC tokens in the skins be useable in conditionals (I dare anyone to use %cY though :D )
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24526 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index cab6f44..fa80e86 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -610,33 +610,45 @@ const char *get_token_value(struct gui_wps *gwps, case WPS_TOKEN_RTC_DAY_OF_MONTH: /* d: day of month (01..31) */ snprintf(buf, buf_size, "%02d", tm->tm_mday); + if (intval) + *intval = tm->tm_mday - 1; return buf; case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: /* e: day of month, blank padded ( 1..31) */ snprintf(buf, buf_size, "%2d", tm->tm_mday); + if (intval) + *intval = tm->tm_mday - 1; return buf; case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: /* H: hour (00..23) */ snprintf(buf, buf_size, "%02d", tm->tm_hour); + if (intval) + *intval = tm->tm_hour; return buf; case WPS_TOKEN_RTC_HOUR_24: /* k: hour ( 0..23) */ snprintf(buf, buf_size, "%2d", tm->tm_hour); + if (intval) + *intval = tm->tm_hour; return buf; case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: /* I: hour (01..12) */ snprintf(buf, buf_size, "%02d", (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); + if (intval) + *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; return buf; case WPS_TOKEN_RTC_HOUR_12: /* l: hour ( 1..12) */ snprintf(buf, buf_size, "%2d", (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); + if (intval) + *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; return buf; case WPS_TOKEN_RTC_MONTH: @@ -649,29 +661,41 @@ const char *get_token_value(struct gui_wps *gwps, case WPS_TOKEN_RTC_MINUTE: /* M: minute (00..59) */ snprintf(buf, buf_size, "%02d", tm->tm_min); + if (intval) + *intval = tm->tm_min; return buf; case WPS_TOKEN_RTC_SECOND: /* S: second (00..59) */ snprintf(buf, buf_size, "%02d", tm->tm_sec); + if (intval) + *intval = tm->tm_sec; return buf; case WPS_TOKEN_RTC_YEAR_2_DIGITS: /* y: last two digits of year (00..99) */ snprintf(buf, buf_size, "%02d", tm->tm_year % 100); + if (intval) + *intval = tm->tm_year % 100; return buf; case WPS_TOKEN_RTC_YEAR_4_DIGITS: /* Y: year (1970...) */ snprintf(buf, buf_size, "%04d", tm->tm_year + 1900); + if (intval) + *intval = tm->tm_year + 1900; return buf; case WPS_TOKEN_RTC_AM_PM_UPPER: /* p: upper case AM or PM indicator */ + if (intval) + *intval = tm->tm_hour/12 == 0 ? 0 : 1; return tm->tm_hour/12 == 0 ? "AM" : "PM"; case WPS_TOKEN_RTC_AM_PM_LOWER: /* P: lower case am or pm indicator */ + if (intval) + *intval = tm->tm_hour/12 == 0 ? 0 : 1; return tm->tm_hour/12 == 0 ? "am" : "pm"; case WPS_TOKEN_RTC_WEEKDAY_NAME: |