FreeBSD7 timezone symbol incompatibility - widgets/e-timezone-dialog/e-timezone-dialog.c

View: New views
2 Messages — Rating Filter:   Alert me  

FreeBSD7 timezone symbol incompatibility - widgets/e-timezone-dialog/e-timezone-dialog.c

by Roman Rybalko-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

uname -a
FreeBSD roma.home 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24
19:59:52 UTC 2008    
root@...:/usr/obj/usr/src/sys/GENERIC  i386

I can't compile the subj because I have another "timezone" symbol:
char * timezone(int zone, int dst);

but in widgets/e-timezone-dialog/e-timezone-dialog.c is such code:
#ifndef G_OS_WIN32 /* Declared properly in time.h already */
extern char *tzname[2];
extern long timezone;
extern int daylight;
#endif

I see this is defined correctly on Linux but it is not on FreeBSD.

I've attached my patch.
Though there is probably need something to do with win32, because I
don't know whether there is localtime_r and gmtime_r

--
WBR,
Roman Rybalko


Index: widgets/e-timezone-dialog/e-timezone-dialog.c
===================================================================
--- widgets/e-timezone-dialog/e-timezone-dialog.c (revision 36416)
+++ widgets/e-timezone-dialog/e-timezone-dialog.c (working copy)
@@ -77,8 +77,6 @@
 
 #ifndef G_OS_WIN32 /* Declared properly in time.h already */
 extern char *tzname[2];
-extern long timezone;
-extern int daylight;
 #endif
 
 static void e_timezone_dialog_class_init (ETimezoneDialogClass *class);
@@ -351,9 +349,16 @@
 get_local_timezone(void)
 {
  icaltimezone *zone;
+
+ long tzoffset;
+ time_t cur = 0; // imagine now is January the 1st 1970
+ struct tm local, gm;
+
+ localtime_r(&cur, &local); // calls tzset()
+ gmtime_r(&cur, &gm);
+ tzoffset = (local.tm_hour - gm.tm_hour) * 3600 + (local.tm_min - gm.tm_min) * 60 + (local.tm_sec - gm.tm_sec);
 
- tzset();
- zone =  icaltimezone_get_builtin_timezone_from_offset (-timezone, tzname[0]);
+ zone =  icaltimezone_get_builtin_timezone_from_offset (tzoffset, tzname[0]);
 
  return zone;
 }

_______________________________________________
Evolution-patches mailing list
Evolution-patches@...
http://mail.gnome.org/mailman/listinfo/evolution-patches

Re: FreeBSD7 timezone symbol incompatibility - widgets/e-timezone-dialog/e-timezone-dialog.c

by Srinivasa Ragavan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In future, create a bug in Bugzilla and post your patch against the bug.
It helps us to track every incoming patch, in case something gets missed
out on emails.

Also, where do you have 'char * timezone(int zone, int dst);' declared?

-Srini.

On Wed, 2008-09-24 at 18:54 +0400, Roman Rybalko wrote:

> Hi All,
>
> uname -a
> FreeBSD roma.home 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24
> 19:59:52 UTC 2008    
> root@...:/usr/obj/usr/src/sys/GENERIC  i386
>
> I can't compile the subj because I have another "timezone" symbol:
> char * timezone(int zone, int dst);
>
> but in widgets/e-timezone-dialog/e-timezone-dialog.c is such code:
> #ifndef G_OS_WIN32 /* Declared properly in time.h already */
> extern char *tzname[2];
> extern long timezone;
> extern int daylight;
> #endif
>
> I see this is defined correctly on Linux but it is not on FreeBSD.
>
> I've attached my patch.
> Though there is probably need something to do with win32, because I
> don't know whether there is localtime_r and gmtime_r
>
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches@...
> http://mail.gnome.org/mailman/listinfo/evolution-patches

_______________________________________________
Evolution-patches mailing list
Evolution-patches@...
http://mail.gnome.org/mailman/listinfo/evolution-patches