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

Re: CVS update: MODIFIED: libsvn_subr ...

From: Branko ╚ibej <brane_at_xbc.nu>
Date: 2001-07-04 00:24:03 CEST

Karl Fogel wrote:

>Branko ´┐Żibej <brane@xbc.nu> writes:
>>Some of that discussion (actually the most relevant parts) never made
>>it to the APR list. I've got copies of some of all of those
>>messages. If people are interested, and David agrees, I can put them
>>in the repository somewhere.
>Can we solve the problem using the APR time stuff as it exists now?
I've already solved the problem. APR now has apr_implode_gmt(), which
always returns a UTC apr_time_t, as long as the exploded time has the
correct tm_gmtoff value. We're using this API in whatever
svn_wc__string_to_time() has become. And I pounded APR into calculating
the correct tm_gmtoff on all platforms I can get my hands on, with all
TZ settings I could find defined -- see the comments in

Thus, this /should/ be fixed.

>The goal is that Subversion's two time functions be perfect inverses
>of each other:
> /* Convert WHEN to an svn string representation allocated in POOL.
> Use svn_time_from_string() for the reverse conversion. */
> svn_stringbuf_t *svn_time_to_string (apr_time_t when, apr_pool_t *pool);
> /* Convert TIMESTR to an apr_time_t. TIMESTR should be of the form
> returned by svn_wc__time_to_string(). */
> apr_time_t svn_time_from_string (svn_stringbuf_t *timestr);
>That is,
> apr_time_t time_a, time_b;
> svn_stringbuf_t *time_str;
> time_a = apr_time_now ();
> time_str = svn_time_to_string (time_a, pool);
> time_b = svn_time_from_string (time_str);
> if (time_a == time_b)
> printf ("something is right");
> else
> printf ("something is wrong");
Does this *still* not work correctly? My tests (on Linux) show that it
does, at least the timestamps in the wc are correct.

>Whether `time_str' expresses the time in GMT or localtime is not
>important -- either way is fine, really, as long as it *tells* which
>zone it is in, so no information is lost.
>I guess this means that svn_time_to_string() must decide to
>consistently always interpret the incoming apr_time_t in localtime or
>in GMT; localtime probably makes most sense, but whichever way, if we
>just document it and always use it correctly, we'll be fine.
The apr_time_t should always be UTC (GMT, whatever). That's what
apr_time_now() returns, and that's what's stored in apr_finfo_t (which
is where the values in the wc came from, originally).

That's because apr_time_t can't tell you which timezone it's in -- but
apr_exploded_time_t can.

>The way APR is behaving now, I haven't been able to get these
>functions to be reliable inverses of each other. Am I just missing
Yes, the fact that issue 404 is resolved. :-)

Seriously: are you actually seeing this problem with the latest APR?

Brane ´┐Żibej
    home:    <brane_at_xbc.nu>             http://www.xbc.nu/brane/
    work:    <branko.cibej_at_hermes.si>   http://www.hermes-softlab.com/
      ACM:   <brane_at_acm.org>            http://www.acm.org/
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:32 2006

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