summaryrefslogtreecommitdiff
path: root/hw/mc146818rtc.c
diff options
context:
space:
mode:
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);
}