[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Time shift problem when calling svn_time_to_cstring (when using Python)?

From: Mathias Weinert <mathias.weinert_at_gfa-net.de>
Date: 2006-06-09 14:29:47 CEST

C. Michael Pilato wrote:
> Subversion times are all stored in GMT. The svn_time_to_cstring() function
> keeps the output in GMT (as denoted by the 'Z' suffix).
> svn_time_to_human_cstring(), however, shows localized time (and reveals the
> timezone offset on which it based its calculations):
>
> % python
> Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
> [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import time, svn.core
> >>> t = time.time()
> >>> svn.core.svn_time_to_cstring(int(t * 1000000))
> '2006-06-08T16:02:11.542558Z'
> >>> svn.core.svn_time_to_human_cstring(int(t * 1000000))
> '2006-06-08 12:02:11 -0400 (Thu, 08 Jun 2006)'
> >>>
>
> As you can see, that second date is four hours off from the first, but the
> offset is display as four hours from GMT, so all is as expected.
>

Thanks for the explanation.

> I don't think you should need to change any of dates in the test expected
> output. Are you seeing something that makes you think otherwise? (Got
> specific examples?)

I just found out where my problem lies. The svn_time_to_cstring delivers
the correct GMT date but mailer.py then prints the date in the human
readable form. As a result of this the output of mailer.py depends on the
time zone of the caller and therefor I will always get differences
between my output and the expected one which is found in mailer-t1.current.

So I think the only possibility to avoid this is to set the local timezone
to GMT before running the test (or setting it within the test). Or do you
have any other idea?

Mathias

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 9 14:30:36 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.