[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: working patch for time offset calculation



"Daniel Wasserhaus" <notgordan@gmail.com> wrote:

> 2007/3/16, Joerg Schilling <Joerg.Schilling@fokus.fraunhofer.de>:
> > "Daniel Wasserhaus" <notgordan@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I just looked through the latest cdrtools-2.01.01a24 release to see if
> > > Jörg has applied my patch for the timezone calculation. Well, he's
> > > using a different way to calculate the timezone offset now:
> > >
> > > local.tm_min -= gmt.tm_min;
> > > local.tm_hour -= gmt.tm_hour;
> > > local.tm_yday -= gmt.tm_yday;
> > > if (local.tm_yday < -2) /* Hit new-year limit */
> > >   local.tm_yday = 1; /* Local is GMT + 1 day */
> > > iso_time[16] = (local.tm_min + 60 *
> > >   (local.tm_hour + 24 * local.tm_yday)) / 15;
> > >
> > > But this only works for those east of greenwich! If you are in a tz
> > > behind GMT/UTC, like the USA, the if expression never catches
> > > (local.tm_yday would be > 2 when local.tm_year != gmt.tm_year). I must
> > > admit though, that my posted patch with the following calculation:
> >
> > Please provide test data that proves that my patch does not work.
> > I did test is with many offsets and it seem to work.
>
> Hi Jörg,
>
> ok, here is the test data. Since I did not want to screw my own
> time/timezone settings, this was done inside a grml live-cd (ram
> only). Booting grml with "grml gmt tz=America/New_York" bootoption and
> building a vanilla cdrtools-2.01.01a24.tar.bz2 with make and setting
> date to 05.01.2007 (to get rid of the current DST) gives the following
> info:

Thank you for the explanation, I verified that the new code now works correctly
for both directions of GMT offset.

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de                (uni)  
       schilling@fokus.fraunhofer.de     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily



Reply to: