diff options
Diffstat (limited to 'hw/mc146818rtc.c')
-rw-r--r-- | hw/mc146818rtc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 789ebd3f68..be9c63db20 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -393,11 +393,16 @@ void rtc_set_date_from_host(RTCState *s) int val; /* set the CMOS date */ - time(&ti); - if (rtc_utc) + 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); - else - tm = localtime(&ti); + } rtc_set_date(s, tm); val = to_bcd(s, (tm->tm_year / 100) + 19); |