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 /apps/gui/skin_engine | |
parent | a70d602f7d445cc7ffa06ba8035957e495f8c8bf (diff) | |
download | rockbox-5513c30e34569d64f5b923b0aeaeea9ef55a0119.tar.gz rockbox-5513c30e34569d64f5b923b0aeaeea9ef55a0119.zip |
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
Diffstat (limited to 'apps/gui/skin_engine')
-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 cab6f44ff9..fa80e86ab6 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, | |||
610 | case WPS_TOKEN_RTC_DAY_OF_MONTH: | 610 | case WPS_TOKEN_RTC_DAY_OF_MONTH: |
611 | /* d: day of month (01..31) */ | 611 | /* d: day of month (01..31) */ |
612 | snprintf(buf, buf_size, "%02d", tm->tm_mday); | 612 | snprintf(buf, buf_size, "%02d", tm->tm_mday); |
613 | if (intval) | ||
614 | *intval = tm->tm_mday - 1; | ||
613 | return buf; | 615 | return buf; |
614 | 616 | ||
615 | case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: | 617 | case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: |
616 | /* e: day of month, blank padded ( 1..31) */ | 618 | /* e: day of month, blank padded ( 1..31) */ |
617 | snprintf(buf, buf_size, "%2d", tm->tm_mday); | 619 | snprintf(buf, buf_size, "%2d", tm->tm_mday); |
620 | if (intval) | ||
621 | *intval = tm->tm_mday - 1; | ||
618 | return buf; | 622 | return buf; |
619 | 623 | ||
620 | case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: | 624 | case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: |
621 | /* H: hour (00..23) */ | 625 | /* H: hour (00..23) */ |
622 | snprintf(buf, buf_size, "%02d", tm->tm_hour); | 626 | snprintf(buf, buf_size, "%02d", tm->tm_hour); |
627 | if (intval) | ||
628 | *intval = tm->tm_hour; | ||
623 | return buf; | 629 | return buf; |
624 | 630 | ||
625 | case WPS_TOKEN_RTC_HOUR_24: | 631 | case WPS_TOKEN_RTC_HOUR_24: |
626 | /* k: hour ( 0..23) */ | 632 | /* k: hour ( 0..23) */ |
627 | snprintf(buf, buf_size, "%2d", tm->tm_hour); | 633 | snprintf(buf, buf_size, "%2d", tm->tm_hour); |
634 | if (intval) | ||
635 | *intval = tm->tm_hour; | ||
628 | return buf; | 636 | return buf; |
629 | 637 | ||
630 | case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: | 638 | case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: |
631 | /* I: hour (01..12) */ | 639 | /* I: hour (01..12) */ |
632 | snprintf(buf, buf_size, "%02d", | 640 | snprintf(buf, buf_size, "%02d", |
633 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); | 641 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); |
642 | if (intval) | ||
643 | *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; | ||
634 | return buf; | 644 | return buf; |
635 | 645 | ||
636 | case WPS_TOKEN_RTC_HOUR_12: | 646 | case WPS_TOKEN_RTC_HOUR_12: |
637 | /* l: hour ( 1..12) */ | 647 | /* l: hour ( 1..12) */ |
638 | snprintf(buf, buf_size, "%2d", | 648 | snprintf(buf, buf_size, "%2d", |
639 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); | 649 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); |
650 | if (intval) | ||
651 | *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; | ||
640 | return buf; | 652 | return buf; |
641 | 653 | ||
642 | case WPS_TOKEN_RTC_MONTH: | 654 | case WPS_TOKEN_RTC_MONTH: |
@@ -649,29 +661,41 @@ const char *get_token_value(struct gui_wps *gwps, | |||
649 | case WPS_TOKEN_RTC_MINUTE: | 661 | case WPS_TOKEN_RTC_MINUTE: |
650 | /* M: minute (00..59) */ | 662 | /* M: minute (00..59) */ |
651 | snprintf(buf, buf_size, "%02d", tm->tm_min); | 663 | snprintf(buf, buf_size, "%02d", tm->tm_min); |
664 | if (intval) | ||
665 | *intval = tm->tm_min; | ||
652 | return buf; | 666 | return buf; |
653 | 667 | ||
654 | case WPS_TOKEN_RTC_SECOND: | 668 | case WPS_TOKEN_RTC_SECOND: |
655 | /* S: second (00..59) */ | 669 | /* S: second (00..59) */ |
656 | snprintf(buf, buf_size, "%02d", tm->tm_sec); | 670 | snprintf(buf, buf_size, "%02d", tm->tm_sec); |
671 | if (intval) | ||
672 | *intval = tm->tm_sec; | ||
657 | return buf; | 673 | return buf; |
658 | 674 | ||
659 | case WPS_TOKEN_RTC_YEAR_2_DIGITS: | 675 | case WPS_TOKEN_RTC_YEAR_2_DIGITS: |
660 | /* y: last two digits of year (00..99) */ | 676 | /* y: last two digits of year (00..99) */ |
661 | snprintf(buf, buf_size, "%02d", tm->tm_year % 100); | 677 | snprintf(buf, buf_size, "%02d", tm->tm_year % 100); |
678 | if (intval) | ||
679 | *intval = tm->tm_year % 100; | ||
662 | return buf; | 680 | return buf; |
663 | 681 | ||
664 | case WPS_TOKEN_RTC_YEAR_4_DIGITS: | 682 | case WPS_TOKEN_RTC_YEAR_4_DIGITS: |
665 | /* Y: year (1970...) */ | 683 | /* Y: year (1970...) */ |
666 | snprintf(buf, buf_size, "%04d", tm->tm_year + 1900); | 684 | snprintf(buf, buf_size, "%04d", tm->tm_year + 1900); |
685 | if (intval) | ||
686 | *intval = tm->tm_year + 1900; | ||
667 | return buf; | 687 | return buf; |
668 | 688 | ||
669 | case WPS_TOKEN_RTC_AM_PM_UPPER: | 689 | case WPS_TOKEN_RTC_AM_PM_UPPER: |
670 | /* p: upper case AM or PM indicator */ | 690 | /* p: upper case AM or PM indicator */ |
691 | if (intval) | ||
692 | *intval = tm->tm_hour/12 == 0 ? 0 : 1; | ||
671 | return tm->tm_hour/12 == 0 ? "AM" : "PM"; | 693 | return tm->tm_hour/12 == 0 ? "AM" : "PM"; |
672 | 694 | ||
673 | case WPS_TOKEN_RTC_AM_PM_LOWER: | 695 | case WPS_TOKEN_RTC_AM_PM_LOWER: |
674 | /* P: lower case am or pm indicator */ | 696 | /* P: lower case am or pm indicator */ |
697 | if (intval) | ||
698 | *intval = tm->tm_hour/12 == 0 ? 0 : 1; | ||
675 | return tm->tm_hour/12 == 0 ? "am" : "pm"; | 699 | return tm->tm_hour/12 == 0 ? "am" : "pm"; |
676 | 700 | ||
677 | case WPS_TOKEN_RTC_WEEKDAY_NAME: | 701 | case WPS_TOKEN_RTC_WEEKDAY_NAME: |