Re: [evolution-patches] patch for bug #60463 calendar



On Wed, 2004-06-30 at 11:58, Rodrigo Moya wrote:
> On Tue, 2004-06-29 at 13:53 +0200, Jerome Lacoste wrote:
> > On Tue, 2004-06-29 at 12:51, chenthill wrote:
> > > hi,
> > >   Attached a patch which gets the default zone as an extra argument,
> > > converts the freebusy time to the default timezone using the function
> > > icatime_from_timet_with_zone() . It was not showing some of the freebusy
> > > times before, since no conversion from UTC timezone to default timezone
> > > was made.
> > > 
> > > thanks, chenthill
> > 
> > THings like
> > 
> > -  itt = icaltime_from_timet (t, 0);
> > +  if (default_zone)
> > +     itt = icaltime_from_timet_with_zone (t, 0, default_zone);
> > +  else
> > +     itt = icaltime_from_timet_with_zone (t, 0, 0);
> >    ipt.start = itt;
> >  
> > 
> > Could be rewritten without making 2 calls to the same method.
> > 
> no, if you send a NULL timezone to icaltime_from_timet_with_zone, it
> will probably crash. As I said in my previous mail, you should be using
> icaltime_from_timet when there's no timezone.

I meant using an intermediate variable. Something along:

-  itt = icaltime_from_timet (t, 0);
+  int zone = (default_zone ? default_zone : 0);
+  itt = icaltime_from_timet_with_zone (t, 0, zone);

Not 100% sure about the type (int) though. You may even remove the intermediate variable and merge the 2 lines.
Can't remember if the syntax (?:) is valid in C but my small test program seems to compile.

Jerome







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