aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/arch
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-01-21 11:20:27 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-01-21 11:20:27 +0000
commitafb13d4890c7b505865b8264247c2049fd0c2227 (patch)
tree2417cb72f24229f2ee3279ca7546ec3beae2bce3 /extras/mini-os/arch
parent3e49205c7a0d947e5a9c37fabee4df1ae07d3135 (diff)
downloadxen-afb13d4890c7b505865b8264247c2049fd0c2227.tar.gz
xen-afb13d4890c7b505865b8264247c2049fd0c2227.tar.bz2
xen-afb13d4890c7b505865b8264247c2049fd0c2227.zip
minios: make time interface POSIX
timespec uses tv_sec and tv_nsec too. gettimeofday takes a tz argument. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/arch')
-rw-r--r--extras/mini-os/arch/ia64/time.c25
-rw-r--r--extras/mini-os/arch/x86/time.c14
2 files changed, 21 insertions, 18 deletions
diff --git a/extras/mini-os/arch/ia64/time.c b/extras/mini-os/arch/ia64/time.c
index e000ced098..cda36e69d4 100644
--- a/extras/mini-os/arch/ia64/time.c
+++ b/extras/mini-os/arch/ia64/time.c
@@ -147,10 +147,10 @@ calculate_time(void)
new = itc_new - itc_alt;
itc_alt = itc_new;
new = ns_from_cycles(new);
- os_time.ts_nsec += new;
- if (os_time.ts_nsec > 1000000000) { /* On overflow. */
- os_time.ts_sec++;
- os_time.ts_nsec -= 1000000000;
+ os_time.tv_nsec += new;
+ if (os_time.tv_nsec > 1000000000) { /* On overflow. */
+ os_time.tv_sec++;
+ os_time.tv_nsec -= 1000000000;
}
}
@@ -177,12 +177,13 @@ monotonic_clock(void)
return delta;
}
-void
-gettimeofday(struct timeval *tv)
+int
+gettimeofday(struct timeval *tv, void *tz)
{
calculate_time();
- tv->tv_sec = os_time.ts_sec; /* seconds */
- tv->tv_usec = NSEC_TO_USEC(os_time.ts_nsec); /* microseconds */
+ tv->tv_sec = os_time.tv_sec; /* seconds */
+ tv->tv_usec = NSEC_TO_USEC(os_time.tv_nsec); /* microseconds */
+ return 0;
};
/*
@@ -253,16 +254,16 @@ init_time(void)
itm_val = (itc_frequency + HZ/2) / HZ;
printk(" itm_val: %ld\n", itm_val);
- os_time.ts_sec = 0;
- os_time.ts_nsec = 0;
+ os_time.tv_sec = 0;
+ os_time.tv_nsec = 0;
if (efi_get_time(&tm)) {
printk(" EFI-Time: %d.%d.%d %d:%d:%d\n", tm.Day,
tm.Month, tm.Year, tm.Hour, tm.Minute, tm.Second);
- os_time.ts_sec = mktime(SWAP(tm.Year), SWAP(tm.Month),
+ os_time.tv_sec = mktime(SWAP(tm.Year), SWAP(tm.Month),
SWAP(tm.Day), SWAP(tm.Hour),
SWAP(tm.Minute), SWAP(tm.Second));
- os_time.ts_nsec = tm.Nanosecond;
+ os_time.tv_nsec = tm.Nanosecond;
} else
printk("efi_get_time() failed\n");
diff --git a/extras/mini-os/arch/x86/time.c b/extras/mini-os/arch/x86/time.c
index 0fad40f6de..c8313705ae 100644
--- a/extras/mini-os/arch/x86/time.c
+++ b/extras/mini-os/arch/x86/time.c
@@ -175,30 +175,32 @@ static void update_wallclock(void)
do {
shadow_ts_version = s->wc_version;
rmb();
- shadow_ts.ts_sec = s->wc_sec;
- shadow_ts.ts_nsec = s->wc_nsec;
+ shadow_ts.tv_sec = s->wc_sec;
+ shadow_ts.tv_nsec = s->wc_nsec;
rmb();
}
while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version));
}
-void gettimeofday(struct timeval *tv)
+int gettimeofday(struct timeval *tv, void *tz)
{
u64 nsec = monotonic_clock();
- nsec += shadow_ts.ts_nsec;
+ nsec += shadow_ts.tv_nsec;
- tv->tv_sec = shadow_ts.ts_sec;
+ tv->tv_sec = shadow_ts.tv_sec;
tv->tv_sec += NSEC_TO_SEC(nsec);
tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL);
+
+ return 0;
}
void block_domain(s_time_t until)
{
struct timeval tv;
- gettimeofday(&tv);
+ gettimeofday(&tv, NULL);
if(monotonic_clock() < until)
{
HYPERVISOR_set_timer_op(until);