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

Re: Subversion and Daylight Savings Time

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-01-16 00:35:14 CET

On Mon, 15 Jan 2007, Mark Phippard wrote:

> On 1/15/07, Mark Phippard <markphip@gmail.com> wrote:
> >
> >On 1/15/07, Daniel Rall <dlr@collab.net> wrote:
> >>
> >> On Mon, 15 Jan 2007, Mark Phippard wrote:
> >> ...
> >> > We have been getting a lot of inquiries from our customers as to how
> >> our
> >> > products are impacted by the upcoming changes to DST. Most are
> >> looking for
> >> > official statements. It might save a lot of time and effort in the
> >> long run
> >> > if someone crafted a statement about Subversion and posted it to the
> >> web
> >> > site so that we could link to it when questions come to the mailing
> >> lists.
> >>
> >> Good idea! Feel like writing one up? :)
> >
> >
> >Sure. I'll at least look into it. I will probably try to keep it more
> >general just saying that we get the date/time from the OS and use routines
> >provided by the OS to transform it. The day of the year that DST changes
> >is
> >not relevant to these routines.

Thanks Mark!

> Index: dst-2007.html^M
> ===================================================================^M
> --- dst-2007.html (revision 0)^M
> +++ dst-2007.html (revision 0)^M
...
> +<h2 style="text-align: center">Statement of Support for 2007 Daylight
> +Saving Time Changes</h2>
> +
> +<p>In August 2005 the US Congress passed the Energy Policy Act, which
> +changes the dates of both the start and end of daylight saving time
> +(DST). When this law goes into effect in 2007, DST will start three
> +weeks earlier (2:00 A.M. on the second Sunday in March) and will
> +end one week later (2:00 A.M. on the first Sunday in November)
> +than what had traditionally occurred. This change was not adopted

How about "universally adopted"?

> +by all countries. For more information see: <a
> +href="http://webexhibits.org/daylightsaving/b.html">
> +http://webexhibits.org/daylightsaving/b.html</a></p>
> +
> +<p>These changes to DST do not require any special changes or fixes to
> +the Subversion code. Subversion primarily uses dates/times to record
> +when changes have been committed to the repository. This code runs
> +on the server and gets the current date/time from the operating system
> +and converts it to UTC using routines provided by the operating system.

Yup, svn_time_to_cstring() produces a string which looks like:

  2006-03-27T13:23:01.497707Z

(IIRC, the Z is for "zulu", which is UTC/GMT.)

> +The Subversion client receives these dates from the server and converts
> +them to the local time zone for display using routines provided by
> +the client operating system.

Exactly happens to the date/time is going to be Subversion
client-specific. While the conversion described above is quite true
for the command-line binary (and a good way to go), it's possible that
other clients (TortoiseSVN, Subclipse, etc.) might choose to display
the time received from the server in some other fashion. Since this
page is about both Subversion's libraries and client, we might want to
indicate as much.

In subversion/svn/log-cmd.c, the command-line client does:

  if (date && date[0])
    {
      /* Convert date to a format for humans. */
      apr_time_t time_temp;
      
      SVN_ERR(svn_time_from_cstring(&time_temp, date, pool));
      date = svn_time_to_human_cstring(time_temp, pool);
    }
  else
    date = _("(no date)");

...which produces a date/time which looks like:

  2006-06-20 12:15:37 -0700 (Tue, 20 Jun 2006)

Interestingly enough, it also produces a date/time like:

  2006-03-27 05:23:01 -0800 (Mon, 27 Mar 2006)

...which I suppose means that it is correctly accounting for DST by
way of the differences in the timezone offsets (-0700 vs. -0800).

If we want to get more specific (not sure that we do), we use the
native OSes routines via a call to APR in subversion/libsvn_subr/time.c:

  /* Get the time into parts */
  apr_time_exp_lt(&exploded_time, when);

> +As such, you should only need to install
> +the patches provided for your operating system and really you should
> +only need to make sure the time on the server is properly adjusted
> +for DST.</p>
...

+1 to commit with tweaks.

- Dan

  • application/pgp-signature attachment: stored
Received on Tue Jan 16 00:56:24 2007

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.