Commit ee22c2f7dbcc59d9b0c0c9e08fafc9c4759b37fc

Authored by bellard
1 parent be3edd95

-localtime option


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@871 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 3 changed files with 11 additions and 1 deletions
@@ -110,7 +110,10 @@ static void cmos_init(int ram_size, int boot_device) @@ -110,7 +110,10 @@ static void cmos_init(int ram_size, int boot_device)
110 110
111 /* set the CMOS date */ 111 /* set the CMOS date */
112 time(&ti); 112 time(&ti);
113 - tm = gmtime(&ti); 113 + if (rtc_utc)
  114 + tm = gmtime(&ti);
  115 + else
  116 + tm = localtime(&ti);
114 rtc_set_date(s, tm); 117 rtc_set_date(s, tm);
115 118
116 val = to_bcd(s, (tm->tm_year / 100) + 19); 119 val = to_bcd(s, (tm->tm_year / 100) + 19);
@@ -129,6 +129,7 @@ int vm_running; @@ -129,6 +129,7 @@ int vm_running;
129 int audio_enabled = 0; 129 int audio_enabled = 0;
130 int pci_enabled = 0; 130 int pci_enabled = 0;
131 int prep_enabled = 0; 131 int prep_enabled = 0;
  132 +int rtc_utc = 1;
132 133
133 /***********************************************************/ 134 /***********************************************************/
134 /* x86 ISA bus support */ 135 /* x86 ISA bus support */
@@ -2015,6 +2016,7 @@ enum { @@ -2015,6 +2016,7 @@ enum {
2015 QEMU_OPTION_no_code_copy, 2016 QEMU_OPTION_no_code_copy,
2016 QEMU_OPTION_pci, 2017 QEMU_OPTION_pci,
2017 QEMU_OPTION_prep, 2018 QEMU_OPTION_prep,
  2019 + QEMU_OPTION_localtime,
2018 }; 2020 };
2019 2021
2020 typedef struct QEMUOption { 2022 typedef struct QEMUOption {
@@ -2065,6 +2067,7 @@ const QEMUOption qemu_options[] = { @@ -2065,6 +2067,7 @@ const QEMUOption qemu_options[] = {
2065 #ifdef TARGET_PPC 2067 #ifdef TARGET_PPC
2066 { "prep", 0, QEMU_OPTION_prep }, 2068 { "prep", 0, QEMU_OPTION_prep },
2067 #endif 2069 #endif
  2070 + { "localtime", 0, QEMU_OPTION_localtime },
2068 { NULL }, 2071 { NULL },
2069 }; 2072 };
2070 2073
@@ -2341,6 +2344,9 @@ int main(int argc, char **argv) @@ -2341,6 +2344,9 @@ int main(int argc, char **argv)
2341 case QEMU_OPTION_prep: 2344 case QEMU_OPTION_prep:
2342 prep_enabled = 1; 2345 prep_enabled = 1;
2343 break; 2346 break;
  2347 + case QEMU_OPTION_localtime:
  2348 + rtc_utc = 0;
  2349 + break;
2344 } 2350 }
2345 } 2351 }
2346 } 2352 }
@@ -170,6 +170,7 @@ void vm_stop(int reason); @@ -170,6 +170,7 @@ void vm_stop(int reason);
170 extern int audio_enabled; 170 extern int audio_enabled;
171 extern int ram_size; 171 extern int ram_size;
172 extern int bios_size; 172 extern int bios_size;
  173 +extern int rtc_utc;
173 174
174 /* XXX: make it dynamic */ 175 /* XXX: make it dynamic */
175 #if defined (TARGET_PPC) 176 #if defined (TARGET_PPC)