Revision 7e0af5d0 vl.c
b/vl.c | ||
---|---|---|
174 | 174 |
NICInfo nd_table[MAX_NICS]; |
175 | 175 |
int vm_running; |
176 | 176 |
int rtc_utc = 1; |
177 |
int rtc_start_date = -1; /* -1 means now */ |
|
177 | 178 |
int cirrus_vga_enabled = 1; |
178 | 179 |
int vmsvga_enabled = 0; |
179 | 180 |
#ifdef TARGET_SPARC |
... | ... | |
7212 | 7213 |
QEMU_OPTION_prom_env, |
7213 | 7214 |
QEMU_OPTION_old_param, |
7214 | 7215 |
QEMU_OPTION_clock, |
7216 |
QEMU_OPTION_startdate, |
|
7215 | 7217 |
}; |
7216 | 7218 |
|
7217 | 7219 |
typedef struct QEMUOption { |
... | ... | |
7318 | 7320 |
{ "old-param", 0, QEMU_OPTION_old_param }, |
7319 | 7321 |
#endif |
7320 | 7322 |
{ "clock", HAS_ARG, QEMU_OPTION_clock }, |
7323 |
{ "startdate", HAS_ARG, QEMU_OPTION_startdate }, |
|
7321 | 7324 |
{ NULL }, |
7322 | 7325 |
}; |
7323 | 7326 |
|
... | ... | |
8107 | 8110 |
case QEMU_OPTION_clock: |
8108 | 8111 |
configure_alarms(optarg); |
8109 | 8112 |
break; |
8113 |
case QEMU_OPTION_startdate: |
|
8114 |
{ |
|
8115 |
struct tm tm; |
|
8116 |
if (!strcmp(optarg, "now")) { |
|
8117 |
rtc_start_date = -1; |
|
8118 |
} else { |
|
8119 |
if (sscanf(optarg, "%d-%d-%dT%d:%d:%d", |
|
8120 |
&tm.tm_year, |
|
8121 |
&tm.tm_mon, |
|
8122 |
&tm.tm_mday, |
|
8123 |
&tm.tm_hour, |
|
8124 |
&tm.tm_min, |
|
8125 |
&tm.tm_sec) == 6) { |
|
8126 |
/* OK */ |
|
8127 |
} else if (sscanf(optarg, "%d-%d-%d", |
|
8128 |
&tm.tm_year, |
|
8129 |
&tm.tm_mon, |
|
8130 |
&tm.tm_mday) == 3) { |
|
8131 |
tm.tm_hour = 0; |
|
8132 |
tm.tm_min = 0; |
|
8133 |
tm.tm_sec = 0; |
|
8134 |
} else { |
|
8135 |
goto date_fail; |
|
8136 |
} |
|
8137 |
tm.tm_year -= 1900; |
|
8138 |
tm.tm_mon--; |
|
8139 |
rtc_start_date = timegm(&tm); |
|
8140 |
if (rtc_start_date == -1) { |
|
8141 |
date_fail: |
|
8142 |
fprintf(stderr, "Invalid date format. Valid format are:\n" |
|
8143 |
"'now' or '2006-06-17T16:01:21' or '2006-06-17'\n"); |
|
8144 |
exit(1); |
|
8145 |
} |
|
8146 |
} |
|
8147 |
} |
|
8148 |
break; |
|
8110 | 8149 |
} |
8111 | 8150 |
} |
8112 | 8151 |
} |
Also available in: Unified diff