1
0
Fork 0
forked from len0rd/rockbox

fat: move fattime_mktime to timefuncs

This moves the time conversion function to timefuncs since it has
uses on ports that don't use the FAT driver. This function has no
dependency on the FAT driver as it is so this should not cause any
issues. To reflect this separation the function was renamed to
dostime_mktime since it is really for DOS timestamps. The places
where it was used have also been updated.

Change-Id: Id98b1448d5c6fcda286846e1d2c736db682bfb52
This commit is contained in:
James Buren 2021-07-03 00:19:58 +00:00
parent d1a92aafff
commit c9f2308a1d
6 changed files with 19 additions and 17 deletions

View file

@ -32,6 +32,20 @@
static struct tm tm;
time_t dostime_mktime(uint16_t dosdate, uint16_t dostime)
{
/* this knows our mktime() only uses these struct tm fields */
struct tm tm;
tm.tm_sec = ((dostime ) & 0x1f) * 2;
tm.tm_min = ((dostime >> 5) & 0x3f);
tm.tm_hour = ((dostime >> 11) );
tm.tm_mday = ((dosdate ) & 0x1f);
tm.tm_mon = ((dosdate >> 5) & 0x0f) - 1;
tm.tm_year = ((dosdate >> 9) ) + 80;
return mktime(&tm);
}
#if !CONFIG_RTC
static inline bool rtc_dirty(void)
{