From 7e0af5d09729c13900e3e7933ec2071a3646017a Mon Sep 17 00:00:00 2001 From: bellard Date: Wed, 7 Nov 2007 16:24:33 +0000 Subject: added -startdate option git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3540 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/mc146818rtc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'hw/mc146818rtc.c') diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 789ebd3f6..be9c63db2 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); -- cgit v1.2.3