void mc146818_device::set_base_datetime() { system_time systime; system_time::full_time current_time; machine().base_datetime(systime); current_time = (m_type == MC146818_UTC) ? systime.utc_time: systime.local_time; // logerror("mc146818_set_base_datetime %02d/%02d/%02d %02d:%02d:%02d\n", // current_time.year % 100, current_time.month + 1, current_time.mday, // current_time.hour,current_time.minute, current_time.second); if (HOURS_24 || (current_time.hour < 12)) m_data[4] = dec_2_local(current_time.hour); else m_data[4] = dec_2_local(current_time.hour - 12) | 0x80; if (m_type != MC146818_IGNORE_CENTURY) CENTURY = dec_2_local(current_time.year /100); m_data[0] = dec_2_local(current_time.second); m_data[2] = dec_2_local(current_time.minute); DAY = dec_2_local(current_time.mday); MONTH = dec_2_local(current_time.month + 1); YEAR = dec_2_local(current_time.year % 100); WEEK_DAY = current_time.weekday; if (current_time.is_dst) m_data[0xb] |= 1; else m_data[0xb] &= ~1; }
void mc146818_device::set_base_datetime() { system_time systime; system_time::full_time current_time; m_machine.base_datetime(systime); current_time = m_config.m_type == mc146818_device_config::MC146818_UTC ? systime.utc_time: systime.local_time; // temporary hack to go back 20 year (e.g. from 2010 -> 1990) // current_time.year -= 20; // logerror("mc146818_set_base_datetime %02d/%02d/%02d %02d:%02d:%02d\n", // current_time.year % 100, current_time.month + 1, current_time.mday, // current_time.hour,current_time.minute, current_time.second); if (HOURS_24 || (current_time.hour < 12)) m_data[4] = dec_2_local(current_time.hour); else m_data[4] = dec_2_local(current_time.hour - 12) | 0x80; if (m_config.m_type != mc146818_device_config::MC146818_IGNORE_CENTURY) CENTURY = dec_2_local(current_time.year /100); m_data[0] = dec_2_local(current_time.second); m_data[2] = dec_2_local(current_time.minute); DAY = dec_2_local(current_time.mday); MONTH = dec_2_local(current_time.month + 1); YEAR = dec_2_local(current_time.year % 100); WEEK_DAY = current_time.weekday; if (current_time.is_dst) m_data[0xb] |= 1; else m_data[0xb] &= ~1; }