From: Jean Guyader Date: Tue, 10 Mar 2009 18:17:27 +0000 (+0000) Subject: Add get_time fonction to display the time. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=219d81d87bae380f7a115b60db5812c27f3a00f5;p=xenclient%2Fioemu.git Add get_time fonction to display the time. --- diff --git a/vl.c b/vl.c index 3a5dc71f..cbe48f73 100644 --- a/vl.c +++ b/vl.c @@ -3674,7 +3674,7 @@ static int parse_macaddr(uint8_t *macaddr, const char *p) long int offset; errno = 0; - offset = strtol(p, &last_char, 0); + offset = strtol(p, &last_char, 0); if (0 == errno && '\0' == *last_char && offset >= 0 && offset <= 0xFFFFFF) { macaddr[3] = (offset & 0xFF0000) >> 16; @@ -3693,7 +3693,7 @@ static int parse_macaddr(uint8_t *macaddr, const char *p) p++; } } - return 0; + return 0; } return -1; @@ -7959,7 +7959,7 @@ int main(int argc, char **argv) if (setrlimit(RLIMIT_MEMLOCK, &rl) != 0) perror("setrlimit(RLIMIT_MEMLOCK)"); #endif - + LIST_INIT (&vm_change_state_head); #ifndef _WIN32 { @@ -8201,7 +8201,7 @@ int main(int argc, char **argv) { /* Could easily be extended to 64 devices if needed */ const char *p; - + boot_devices_bitmap = 0; for (p = boot_devices; *p != '\0'; p++) { /* Allowed boot devices are: @@ -9017,7 +9017,7 @@ int main(int argc, char **argv) close(fd); } - + if (dom0_input) dom0_driver_init(dom0_input); @@ -9064,3 +9064,16 @@ int main(int argc, char **argv) #endif return 0; } + +char *get_time(void) +{ + char buff[128]; + char *str; + struct timeval tv; + + gettimeofday(&tv, NULL); + str = malloc(256); + strftime(buff, 128, "%T", localtime(&tv.tv_sec)); + sprintf(str, "%s:%06d", buff, tv.tv_usec); + return str; +}