forked from len0rd/rockbox
Corrected get_time(). This should fix the bad file date bug. Also changed status.c to use get_time() instead of reading directly from RTC.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3170 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8ed1a3a409
commit
cc11e885d1
4 changed files with 7 additions and 10 deletions
|
@ -143,7 +143,7 @@ static char *create_filename(void)
|
||||||
|
|
||||||
/* Create a filename: RYYMMDDHHMMSS.mp3 */
|
/* Create a filename: RYYMMDDHHMMSS.mp3 */
|
||||||
snprintf(fname, 32, "/R%02d%02d%02d%02d%02d%02d.mp3",
|
snprintf(fname, 32, "/R%02d%02d%02d%02d%02d%02d.mp3",
|
||||||
tm->tm_year-2000, tm->tm_mon, tm->tm_mday,
|
tm->tm_year%100, tm->tm_mon, tm->tm_mday,
|
||||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||||
|
|
||||||
DEBUGF("Filename: %s\n", fname);
|
DEBUGF("Filename: %s\n", fname);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
#include "wps.h"
|
#include "wps.h"
|
||||||
#ifdef HAVE_RTC
|
#ifdef HAVE_RTC
|
||||||
#include "rtc.h"
|
#include "timefuncs.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
|
@ -88,7 +88,7 @@ void status_draw(void)
|
||||||
int battlevel = battery_level();
|
int battlevel = battery_level();
|
||||||
int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume);
|
int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume);
|
||||||
#if defined(HAVE_LCD_BITMAP) && defined(HAVE_RTC)
|
#if defined(HAVE_LCD_BITMAP) && defined(HAVE_RTC)
|
||||||
int hour, minute;
|
struct tm* tm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !global_settings.statusbar )
|
if ( !global_settings.statusbar )
|
||||||
|
@ -247,11 +247,8 @@ void status_draw(void)
|
||||||
if (keys_locked)
|
if (keys_locked)
|
||||||
statusbar_icon_lock();
|
statusbar_icon_lock();
|
||||||
#ifdef HAVE_RTC
|
#ifdef HAVE_RTC
|
||||||
hour = rtc_read(3);
|
tm = get_time();
|
||||||
hour = ((hour & 0x30) >> 4) * 10 + (hour & 0x0f);
|
statusbar_time(tm->tm_hour, tm->tm_min);
|
||||||
minute = rtc_read(2);
|
|
||||||
minute = ((minute & 0x70) >> 4) * 10 + (minute & 0x0f);
|
|
||||||
statusbar_time(hour, minute);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT);
|
lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT);
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct tm *get_time(void)
|
||||||
tm.tm_hour = ((rtcbuf[3] & 0x30) >> 4) * 10 + (rtcbuf[3] & 0x0f);
|
tm.tm_hour = ((rtcbuf[3] & 0x30) >> 4) * 10 + (rtcbuf[3] & 0x0f);
|
||||||
tm.tm_mday = ((rtcbuf[5] & 0x30) >> 4) * 10 + (rtcbuf[5] & 0x0f);
|
tm.tm_mday = ((rtcbuf[5] & 0x30) >> 4) * 10 + (rtcbuf[5] & 0x0f);
|
||||||
tm.tm_mon = ((rtcbuf[6] & 0x10) >> 4) * 10 + (rtcbuf[6] & 0x0f);
|
tm.tm_mon = ((rtcbuf[6] & 0x10) >> 4) * 10 + (rtcbuf[6] & 0x0f);
|
||||||
tm.tm_year = ((rtcbuf[7] & 0xf0) >> 4) * 10 + (rtcbuf[7] & 0x0f) + 2000;
|
tm.tm_year = ((rtcbuf[7] & 0xf0) >> 4) * 10 + (rtcbuf[7] & 0x0f) + 100;
|
||||||
tm.tm_wday = rtcbuf[4] & 0x07;
|
tm.tm_wday = rtcbuf[4] & 0x07;
|
||||||
tm.tm_yday = 0; /* Not implemented for now */
|
tm.tm_yday = 0; /* Not implemented for now */
|
||||||
tm.tm_isdst = -1; /* Not implemented for now */
|
tm.tm_isdst = -1; /* Not implemented for now */
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct tm
|
||||||
int tm_hour; /* hours */
|
int tm_hour; /* hours */
|
||||||
int tm_mday; /* day of the month */
|
int tm_mday; /* day of the month */
|
||||||
int tm_mon; /* month */
|
int tm_mon; /* month */
|
||||||
int tm_year; /* year */
|
int tm_year; /* year since 1900 */
|
||||||
int tm_wday; /* day of the week */
|
int tm_wday; /* day of the week */
|
||||||
int tm_yday; /* day in the year */
|
int tm_yday; /* day in the year */
|
||||||
int tm_isdst; /* daylight saving time */
|
int tm_isdst; /* daylight saving time */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue