Re: BEAST on FreeBSD: timezone



>>>>> "TJ" == Tim Janik <timj@gtk.org> writes, in response to
>>>>> "kaj" == myself

Hi!  Thanks for the response!

 kaj> sfitime.c:62: warning: assignment makes integer from pointer
 kaj> without a cast

 kaj> (See code below.)  Later, make check fails to convert a numeric
 kaj> time to a string and back to the same value (in testsfi.c:81),
 kaj> and I think this warning is what causes that.

 TJ> eek, we need that value to transfrom between UTC times in bse
 TJ> files, and the local time handling used in the program. i've
 TJ> appended the timezone manual page from linux, so you know what
 TJ> the value is exactly. then, we'll need to find a FreeBSD
 TJ> equivalent for that.

I've verifyed thats what causing the assert failure, and I have a
patch for it (attached).  And I actually thinks that this method is
better, as it makes it more obvious that the value used is gotten from
the call to localtime (which seems to be of no use in the original
code, but actually sets the timezone as a side effekt).

And about the manual page, I actually think that what conforms to
posix in that is the tzset() function, not the timezone and daylight
variables which happens to be described in the same man page.  Note
how the "CONFORMING TO" section also names BSD 4.3, while under NOTES
BSD 4.3 is said to have "had a routine char *timezone(zone,dst)"
(which is just the same as FreeBSD still has today).


However, I havn't actually got it working on FreeBSD 5.2 yet, as
testsfi crashes with a segv while checknig Threading (but after
completing the Time and some other tests).  I hope to find the time to
debug this one of the nearest days.

-- 
Rasmus Kaj ----------------------------------------------- rasmus@kaj.se
 \                                      Put no trust in cryptic comments
  \------------------------------------- http://www.stacken.kth.se/~kaj/
--- sfi/sfitime.c.orig	Fri Feb 13 23:02:49 2004
+++ sfi/sfitime.c	Fri Feb 13 23:10:07 2004
@@ -58,8 +58,9 @@
   if (error)
     sfi_info ("gettimeofday() failed: %s", g_strerror (errno));
   t = tv.tv_sec + tv.tv_usec / 1000000;
-  localtime (&t);
-  gmt_diff = timezone;
+  struct tm tmdata;
+  localtime_r(&t, &tmdata);
+  gmt_diff = -tmdata.tm_gmtoff;
   gmt_diff *= SFI_USEC_FACTOR;
 }
 


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