[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: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2006-06-08 18:04:48 CEST

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))
>>> 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.

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?)

Mathias Weinert wrote:
> Hi folks,
> When I wanted to update the test script for mailer.py I encountered the
> following problem for which I need your advice.
> After running the test (including mailer-tweak.py) I found different
> dates/times in my output compared to the one from the repository. There
> is a difference of exactly 9 houres for every date.
> So my first thought was that this has to do something with my local
> time zone. But when the function svn_time_to_cstring is supposed to
> return GMT there shouldn't be any problem.
> When I call svn_time_to_cstring with 0 as argument I get
> 1970-01-01T00:00:00.000000Z so again it seems as if this function is
> independent from my local time zone.
> Can anybody tell me if it's okay to change the date in the expected
> output file or did I miss something?
> Thank you!
> Mathias
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Thu Jun 8 18:07:14 2006

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