mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
added -startdate option
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3540 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
2331d91e77
commit
7e0af5d097
4 changed files with 54 additions and 4 deletions
39
vl.c
39
vl.c
|
@ -174,6 +174,7 @@ int nb_nics;
|
|||
NICInfo nd_table[MAX_NICS];
|
||||
int vm_running;
|
||||
int rtc_utc = 1;
|
||||
int rtc_start_date = -1; /* -1 means now */
|
||||
int cirrus_vga_enabled = 1;
|
||||
int vmsvga_enabled = 0;
|
||||
#ifdef TARGET_SPARC
|
||||
|
@ -7212,6 +7213,7 @@ enum {
|
|||
QEMU_OPTION_prom_env,
|
||||
QEMU_OPTION_old_param,
|
||||
QEMU_OPTION_clock,
|
||||
QEMU_OPTION_startdate,
|
||||
};
|
||||
|
||||
typedef struct QEMUOption {
|
||||
|
@ -7318,6 +7320,7 @@ const QEMUOption qemu_options[] = {
|
|||
{ "old-param", 0, QEMU_OPTION_old_param },
|
||||
#endif
|
||||
{ "clock", HAS_ARG, QEMU_OPTION_clock },
|
||||
{ "startdate", HAS_ARG, QEMU_OPTION_startdate },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -8107,6 +8110,42 @@ int main(int argc, char **argv)
|
|||
case QEMU_OPTION_clock:
|
||||
configure_alarms(optarg);
|
||||
break;
|
||||
case QEMU_OPTION_startdate:
|
||||
{
|
||||
struct tm tm;
|
||||
if (!strcmp(optarg, "now")) {
|
||||
rtc_start_date = -1;
|
||||
} else {
|
||||
if (sscanf(optarg, "%d-%d-%dT%d:%d:%d",
|
||||
&tm.tm_year,
|
||||
&tm.tm_mon,
|
||||
&tm.tm_mday,
|
||||
&tm.tm_hour,
|
||||
&tm.tm_min,
|
||||
&tm.tm_sec) == 6) {
|
||||
/* OK */
|
||||
} else if (sscanf(optarg, "%d-%d-%d",
|
||||
&tm.tm_year,
|
||||
&tm.tm_mon,
|
||||
&tm.tm_mday) == 3) {
|
||||
tm.tm_hour = 0;
|
||||
tm.tm_min = 0;
|
||||
tm.tm_sec = 0;
|
||||
} else {
|
||||
goto date_fail;
|
||||
}
|
||||
tm.tm_year -= 1900;
|
||||
tm.tm_mon--;
|
||||
rtc_start_date = timegm(&tm);
|
||||
if (rtc_start_date == -1) {
|
||||
date_fail:
|
||||
fprintf(stderr, "Invalid date format. Valid format are:\n"
|
||||
"'now' or '2006-06-17T16:01:21' or '2006-06-17'\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue