summaryrefslogtreecommitdiff
path: root/hw/mc146818rtc.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-17 11:42:19 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-17 11:42:19 +0000
commitf650305967f3e9a2fe96f59de3062fd9e8b189d0 (patch)
tree4788c0aea4647bae6201094af7b2b6c752ccad74 /hw/mc146818rtc.c
parenta0d69e0097cb87e3b384ab2caa2341d097b25313 (diff)
downloadqemu-f650305967f3e9a2fe96f59de3062fd9e8b189d0.zip
Unify RTCs that use host time, fix M48t59 alarm.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3984 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/mc146818rtc.c')
-rw-r--r--hw/mc146818rtc.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index e1e6427687..30bb0449da 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -392,24 +392,14 @@ void rtc_set_date(RTCState *s, const struct tm *tm)
static void rtc_set_date_from_host(RTCState *s)
{
- time_t ti;
- struct tm *tm;
+ struct tm tm;
int val;
/* set the CMOS date */
- if (rtc_start_date == -1) {
- time(&ti);
- if (rtc_utc)
- tm = gmtime(&ti);
- else
- tm = localtime(&ti);
- } else {
- ti = rtc_start_date;
- tm = gmtime(&ti);
- }
- rtc_set_date(s, tm);
+ qemu_get_timedate(&tm, 0);
+ rtc_set_date(s, &tm);
- val = to_bcd(s, (tm->tm_year / 100) + 19);
+ val = to_bcd(s, (tm.tm_year / 100) + 19);
rtc_set_memory(s, REG_IBM_CENTURY_BYTE, val);
rtc_set_memory(s, REG_IBM_PS2_CENTURY_BYTE, val);
}