Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] Incorrect time zone conversion in the output of search

From: Terry Hung <terryh(at)not-real.slac.stanford.edu>
Date: Thu Dec 06 2007 - 16:19:31 GMT
Bill,

   The simple test did activate the segment of the code you mentioned in the
previous email, and it worked well. But our search activated the 
segetResultPropValue function instead:

    if ( is_meta_date(meta_entry) )
    {
        unsigned long i;
        /* i = *(unsigned long *) prop->propValue; */ /* read binary */
        i = convPropValue2ULong(prop->propValue); /* read binary */
        i = UNPACKLONG(i);     /* Convert the portable number */
        pv->datatype = PROP_DATE;
        pv->value.v_date = (time_t)i;
        freeProperty( prop );
        return pv;
    }

    And later in the process, the function printPropertyResultControl (in 
result_output.c) uses strftime to derive a local time that is off by 8
hours relative to the correct value. I dumped the value of pv->value.v_date 
at this point and it is already off by 8 hours before it reached the 'return'
command in the code above.

    The result looks like this:

    1 test 12:22 -- rank: 1000
    Date: Thu, 06 Dec 2007 08:22:54 GMT From: Terry Hung test 12:22 628-body
    Date:	2007-12-06 08:22:54 PST  

    It should be 00:22:54 PST. The 08:22:54 GMT is the actual timestamp of 
the file.

   Thanks for looking into this!

-- 
Terry Hung - Stanford Linear Accelerator Center
e-mail: terryh@slac.stanford.edu 


 
> On Wed, Dec 05, 2007 at 02:32:04PM -0800, Terry Hung wrote:
> > Hi,
> > 
> >    We observed that up to 9 hours of information did not show up when we used
> > time limits as criteria. The time zone conversion of disk files seems to be 
> > incorrect. 
> > 
> > Example 1:
> > 
> >     1. Search in a CET time zone		#__ Title of message
> >     Date1:  2006-02-07 18:29:08 GMT 		#__ the original file timestamp
> >     Date:   2006-02-08 03:29:08 CET		#__ the timestamp by swish-e
> >     <snip>...
> > 
> >     Swish-e conversion: 2006-02-07 18:29:08 GMT -> 2006-02-08 03:29:08 CET
> >     Correct conversion: 2006-02-07 18:29:08 GMT -> 2006-02-07 19:29:08 CET
> > 
> >   The "Date1" is the original timestamp of the file while the "Date:" is the 
> > timestamp derived by swish-e. The conversion seems to be 8 hours off since
> > CET=GMT+1hr.
> 
> 
> There's no timezone info stored in the index, just a unix
> timestamp.  So, I'd expect server configuration would be the
> difference.
> 
> 
> The dates that swish does display are done with:
> 
>     if ( is_meta_date(meta_entry) )
>     {
>         s=emalloc(30);
>         i = convPropValue2ULong(prop->propValue); /* read binary */
>         i = UNPACKLONG(i);     /* Convert the portable number */
>         strftime(s,30, DATE_FORMAT_STRING, (struct tm *)localtime((time_t *)&i));
>         return s;
>     }
> 
> This looks right, no?
> 
> moseley@bumby:~$ date                   
> Wed Dec  5 17:51:14 PST 2007
> moseley@bumby:~$ date -u
> Thu Dec  6 01:51:16 UTC 2007
> 
> moseley@bumby:~$ echo hello > foo.txt
> moseley@bumby:~$ swish-e -i foo.txt -v0
> 
> moseley@bumby:~$ swish-e -w not dkdk -p swishlastmodified -H0
> 1000 foo.txt "foo.txt" 6 "2007-12-05 17:51:32 PST"
> 
> moseley@bumby:~$ TZ=CET swish-e -w not dkdk -p swishlastmodified -H0 
> 1000 foo.txt "foo.txt" 6 "2007-12-06 02:51:32 CET"
> 
> 
> 
> -- 
> Bill Moseley
> moseley@hank.org
> 
> Unsubscribe from or help with the swish-e list: 
>    http://swish-e.org/Discussion/
> 
> Help with Swish-e:
>    http://swish-e.org/current/docs
> 
> _______________________________________________
> Users mailing list
> Users@lists.swish-e.org
> http://lists.swish-e.org/listinfo/users
> 

_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Thu Dec 6 11:19:39 2007