diff options
author | Markus Braun <markus.braun@krawel.de> | 2002-08-09 13:50:58 +0000 |
---|---|---|
committer | Markus Braun <markus.braun@krawel.de> | 2002-08-09 13:50:58 +0000 |
commit | 2012acf0a805793d970621ec0ab32bdb2b6ebd61 (patch) | |
tree | cc5c47180458aa83df42ba905bcb8dfc9c9f74d0 /apps/settings.c | |
parent | 3181f68eff2951029e56293e6003eff34c499584 (diff) | |
download | rockbox-2012acf0a805793d970621ec0ab32bdb2b6ebd61.tar.gz rockbox-2012acf0a805793d970621ec0ab32bdb2b6ebd61.zip |
changed display format for time/date setting menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1646 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/settings.c b/apps/settings.c index 826d87ab60..274a124d31 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -553,8 +553,10 @@ void set_option(char* string, int* variable, char* options[], int numoptions ) | |||
553 | #ifdef HAVE_RTC | 553 | #ifdef HAVE_RTC |
554 | #define INDEX_X 0 | 554 | #define INDEX_X 0 |
555 | #define INDEX_Y 1 | 555 | #define INDEX_Y 1 |
556 | #define INDEX_WIDTH 2 | ||
556 | char *dayname[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; | 557 | char *dayname[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; |
557 | char cursor[][2]={{9, 1}, {12, 1}, {15, 1}, {9, 2}, {12, 2}, {15, 2}}; | 558 | char *monthname[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; |
559 | char cursor[][3]={{0, 1, 2}, {3, 1, 2}, {6, 1, 2}, {4, 2, 4}, {9, 2, 3}, {13, 2, 2}}; | ||
558 | char daysinmonth[]={31,28,31,30,31,30,31,31,30,31,30,31}; | 560 | char daysinmonth[]={31,28,31,30,31,30,31,31,30,31,30,31}; |
559 | 561 | ||
560 | void set_time(char* string, int timedate[]) | 562 | void set_time(char* string, int timedate[]) |
@@ -574,36 +576,36 @@ void set_time(char* string, int timedate[]) | |||
574 | 576 | ||
575 | while ( !done ) { | 577 | while ( !done ) { |
576 | /* calculate the number of days in febuary */ | 578 | /* calculate the number of days in febuary */ |
577 | realyear=timedate[5]+2000; | 579 | realyear=timedate[3]+2000; |
578 | if((realyear%4==0 && !(realyear%100 == 0)) || realyear%400 == 0) /* for february depends on year */ | 580 | if((realyear%4==0 && !(realyear%100 == 0)) || realyear%400 == 0) /* for february depends on year */ |
579 | daysinmonth[1]=29; | 581 | daysinmonth[1]=29; |
580 | else | 582 | else |
581 | daysinmonth[1]=28; | 583 | daysinmonth[1]=28; |
582 | 584 | ||
583 | /* fix day if month or year changed */ | 585 | /* fix day if month or year changed */ |
584 | timedate[3]=timedate[3]<daysinmonth[timedate[4]-1]?timedate[3]:daysinmonth[timedate[4]-1]; | 586 | timedate[5]=timedate[5]<daysinmonth[timedate[4]-1]?timedate[5]:daysinmonth[timedate[4]-1]; |
585 | 587 | ||
586 | /* calculate day of week */ | 588 | /* calculate day of week */ |
587 | julianday=0; | 589 | julianday=0; |
588 | for(i=0;i<timedate[4]-1;i++) { | 590 | for(i=0;i<timedate[4]-1;i++) { |
589 | julianday+=daysinmonth[i]; | 591 | julianday+=daysinmonth[i]; |
590 | } | 592 | } |
591 | julianday+=timedate[3]; | 593 | julianday+=timedate[5]; |
592 | timedate[6]=(realyear+julianday+(realyear-1)/4-(realyear-1)/100+(realyear-1)/400+7-1)%7; | 594 | timedate[6]=(realyear+julianday+(realyear-1)/4-(realyear-1)/100+(realyear-1)/400+7-1)%7; |
593 | 595 | ||
594 | snprintf(buffer, sizeof(buffer), "Time %02d:%02d:%02d", | 596 | snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d", |
595 | timedate[0], | 597 | timedate[0], |
596 | timedate[1], | 598 | timedate[1], |
597 | timedate[2]); | 599 | timedate[2]); |
598 | lcd_puts(0,1,buffer); | 600 | lcd_puts(0,1,buffer); |
599 | 601 | ||
600 | snprintf(buffer, sizeof(buffer), "Date %s %02d.%02d.%02d", | 602 | snprintf(buffer, sizeof(buffer), "%s 20%02d %s %02d", |
601 | dayname[timedate[6]], | 603 | dayname[timedate[6]], |
602 | timedate[3], | 604 | timedate[3], |
603 | timedate[4], | 605 | monthname[timedate[4]-1], |
604 | timedate[5]); | 606 | timedate[5]); |
605 | lcd_puts(0,2,buffer); | 607 | lcd_puts(0,2,buffer); |
606 | lcd_invertrect(cursor[cursorpos][INDEX_X]*6,cursor[cursorpos][INDEX_Y]*8,12,8); | 608 | lcd_invertrect(cursor[cursorpos][INDEX_X]*6,cursor[cursorpos][INDEX_Y]*8,cursor[cursorpos][INDEX_WIDTH]*6,8); |
607 | lcd_puts(0,4,"ON to set"); | 609 | lcd_puts(0,4,"ON to set"); |
608 | lcd_puts(0,5,"OFF to revert"); | 610 | lcd_puts(0,5,"OFF to revert"); |
609 | lcd_update(); | 611 | lcd_update(); |
@@ -621,17 +623,17 @@ void set_time(char* string, int timedate[]) | |||
621 | min=0; | 623 | min=0; |
622 | steps=60; | 624 | steps=60; |
623 | break; | 625 | break; |
624 | case 3: /* day */ | 626 | case 3: /* year */ |
625 | min=1; | 627 | min=0; |
626 | steps=daysinmonth[timedate[4]-1]; | 628 | steps=100; |
627 | break; | 629 | break; |
628 | case 4: /* month */ | 630 | case 4: /* month */ |
629 | min=1; | 631 | min=1; |
630 | steps=12; | 632 | steps=12; |
631 | break; | 633 | break; |
632 | case 5: /* year */ | 634 | case 5: /* day */ |
633 | min=0; | 635 | min=1; |
634 | steps=100; | 636 | steps=daysinmonth[timedate[4]-1]; |
635 | break; | 637 | break; |
636 | } | 638 | } |
637 | } | 639 | } |