From: Amos Kong <[email protected]>

$ ntpdate -d -q clock.redhat.com; date
27 May 07:53:40 ntpdate[5124]: ntpdate [email protected] Sat Aug  7 00:36:25 UTC 
2010 (1)
...
reference time:    d189668e.cf49d65e  Fri, May 27 2011  7:53:50.809
originate timestamp: d1896690.bf062200  Fri, May 27 2011  7:53:52.746  ---> 
host_time
transmit timestamp:  d1896685.c0c87980  Fri, May 27 2011  7:53:41.753
...
27 May 07:53:42 ntpdate[5124]: step time server 66.187.233.4 offset 10.826804 
sec
Fri May 27 07:53:42 CST 2011   ----> guest_time

The offset(got by ntpdate cmd) = host_time - guest_time
So guest_time = host_time - float(offset)

When get time by 'w32tm /stripchart /samples:1 /computer:clock.redhat.com'
The offset(got by w32m cmd) = host_time - guest_time
So host_time = guest_time + float(offset)

We just compare offset relatively, so this error doesn't effect timedrift tests.

CC: Pu Yiqiao <[email protected]>
Signed-off-by: Amos Kong <[email protected]>
---
 client/virt/virt_test_utils.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/virt/virt_test_utils.py b/client/virt/virt_test_utils.py
index e3a18d2..2636352 100644
--- a/client/virt/virt_test_utils.py
+++ b/client/virt/virt_test_utils.py
@@ -380,7 +380,7 @@ def get_time(session, time_command, time_filter_re, 
time_format):
             host_main, host_mantissa = re.findall(time_filter_re, o)[0]
             host_time = (time.mktime(time.strptime(host_main, time_format)) +
                          float("0.%s" % host_mantissa))
-            guest_time = host_time + float(offset)
+            guest_time = host_time - float(offset)
         else:
             guest_time =  re.findall(time_filter_re, o)[0]
             offset = re.findall("o:(.*)s", o)[0]
@@ -392,7 +392,7 @@ def get_time(session, time_command, time_filter_re, 
time_format):
             else:
                 guest_time = guest_time[:-3]
             guest_time = time.mktime(time.strptime(guest_time, time_format))
-            host_time = guest_time - float(offset)
+            host_time = guest_time + float(offset)
 
     return (host_time, guest_time)
 
-- 
1.7.1

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to