ia64/xen-unstable

changeset 13902:5982d478698f

[IA64] Add localtime setting for PV/IA64 domain

Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
author awilliam@xenbuild2.aw
date Mon Feb 12 10:06:46 2007 -0700 (2007-02-12)
parents 46a8d51134d0
children 8bdbe88e422f
files xen/arch/ia64/xen/fw_emul.c
line diff
     1.1 --- a/xen/arch/ia64/xen/fw_emul.c	Mon Feb 12 10:02:10 2007 -0700
     1.2 +++ b/xen/arch/ia64/xen/fw_emul.c	Mon Feb 12 10:06:46 2007 -0700
     1.3 @@ -33,6 +33,7 @@
     1.4  #include <xen/console.h>
     1.5  #include <xen/hypercall.h>
     1.6  #include <xen/softirq.h>
     1.7 +#include <xen/time.h>
     1.8  
     1.9  static DEFINE_SPINLOCK(efi_time_services_lock);
    1.10  
    1.11 @@ -675,6 +676,9 @@ efi_emulate_get_time(
    1.12  	struct page_info *tv_page = NULL;
    1.13  	struct page_info *tc_page = NULL;
    1.14  	efi_status_t status = 0;
    1.15 +	efi_time_t *tvp;
    1.16 +	struct tm timeptr;
    1.17 +	unsigned long xtimesec;
    1.18  
    1.19  	tv = efi_translate_domain_addr(tv_addr, fault, &tv_page);
    1.20  	if (*fault != IA64_NO_FAULT)
    1.21 @@ -687,6 +691,17 @@ efi_emulate_get_time(
    1.22  
    1.23  	spin_lock(&efi_time_services_lock);
    1.24  	status = (*efi.get_time)((efi_time_t *) tv, (efi_time_cap_t *) tc);
    1.25 +	tvp = (efi_time_t *)tv;
    1.26 +	xtimesec = mktime(tvp->year, tvp->month, tvp->day, tvp->hour,
    1.27 +	                  tvp->minute, tvp->second);
    1.28 +	xtimesec += current->domain->time_offset_seconds;
    1.29 +	timeptr = gmtime(xtimesec);
    1.30 +	tvp->second = timeptr.tm_sec;
    1.31 +	tvp->minute = timeptr.tm_min;
    1.32 +	tvp->hour   = timeptr.tm_hour;
    1.33 +	tvp->day    = timeptr.tm_mday;
    1.34 +	tvp->month  = timeptr.tm_mon + 1;
    1.35 +	tvp->year   = timeptr.tm_year + 1900;
    1.36  	spin_unlock(&efi_time_services_lock);
    1.37  
    1.38  errout: