#344 ✓resolved
Daniel Meyer

[PATCH] do_mysql-0.9.1 compile fails on Solaris 5.11

Reported by Daniel Meyer | June 11th, 2008 @ 11:45 AM

Platform: Sun Solaris 5.11 build 86 on x86 with Sun Studio compiler.

Using the pkg:/SUNWmysql5@5.0.45-0.86 package places the libraries and headers under /usr/mysql/5.0 which are not found during compile. In addition extconf.rb is not configured to detect use of the Sun Studio compiler and adds -Wall to $CFLAGS which is not supported.

I believe the platform does not support tm_gmtoff functionality and thus fails to compile. I've made some modifications to hopefully accomplish the equivalent in ANSI C. The module builds and installs without error. I would appreciate a review of the technical correctness of the workaround.

do_mysql_ext.c:
183a184
>       long gmtoffset;
185,186c186,187
<       time_t rawtime;
<       struct tm * timeinfo;
---
>       time_t t1, t2;
>       struct tm tm;
197,200c198,203
<       // Get localtime
<       time(&rawtime);
<       timeinfo = localtime(&rawtime);
<       
---
>       // begin ANSI GMT offset calculation
>       t1 = time(0);
>       tm = *gmtime(&t1);
>       t2 = mktime(&tm);
>       gmtoffset = (long) difftime(t1,t2);
> 
203,204c206,207
<       int hour_offset = abs(timeinfo->tm_gmtoff) / 3600;
<       int minute_offset = abs(timeinfo->tm_gmtoff) % 3600 / 60;
---
>       int hour_offset = abs(gmtoffset) / 3600;
>       int minute_offset = abs(gmtoffset) % 3600 / 60;
207c210
<       if (timeinfo->tm_gmtoff < 0) {
---
>       if (gmtoffset < 0) {
231c234
<       offset = seconds_to_offset(timeinfo->tm_gmtoff);
---
>       offset = seconds_to_offset(gmtoffset);

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Referenced by

Pages