gnokii-users
[Top][All Lists]
Advanced

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

Re: warning: pointer targets in assignment differ in signedness


From: Dan Oetting
Subject: Re: warning: pointer targets in assignment differ in signedness
Date: Wed, 4 Jan 2006 12:42:46 -0700


On Jan 4, 2006, at 12:56 AM, Pawel Kot wrote:

Hi,

2006/1/4, Dan Oetting <address@hidden>:
And this is an example of why you want to see warnings: (does this
code even work?)

Sure it works.

in file nokia-decoding.c line 252:

static gn_error calnote_get_alarm(int alarmdiff, gn_timestamp
*time, gn_timestamp *alarm)
{
     time_t t_alarm;
     struct tm tm_time, *tm_alarm;
...
     t_alarm += timezone;

This is adding the pointer to the function timezone() instead of the
offset from *time (or *alarm).

No. Do 'man timezone'. This is variable exported from time.h and is of
type long int.


Yes and no. Some BSD UNIX variants define char *timezone(int,int) to return the timezone name. Some Linux variants define the global extern long timezone. It took me forever to to find a definitive answer but I think this will do..

<http://www.gnu.org/software/libc/manual/html_node/Time-Zone-Functions.html#Time-Zone-Functions>

21.4.8 Functions and Variables for Time Zones

The following variables are defined for compatibility with System V Unix. Like tzname, these variables are set by calling tzset or the other time conversion functions.

— Variable: long int timezone

This contains the difference between UTC and the latest local standard time, in seconds west of UTC. For example, in the U.S. Eastern time zone, the value is 5*60*60. Unlike the tm_gmtoff member of the broken-down time structure, this value is not adjusted for daylight saving, and its sign is reversed. In GNU programs it is better to use tm_gmtoff, since it contains the correct offset even when it is not the latest one.

-- Dan O.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]