Now handle_message_tag_time() doesn't use "timezone" since it is not defined
in *BSD.
This commit is contained in:
parent
4886cc8258
commit
9a789bc9e7
|
@ -1326,6 +1326,26 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol
|
|||
rawname, NULL, 0, tags_data->timestamp);
|
||||
}
|
||||
|
||||
/* Returns the timezone offset. This should be the same as the variable
|
||||
* "timezone" in time.h, but *BSD doesn't have it.
|
||||
*/
|
||||
static int
|
||||
get_timezone(void)
|
||||
{
|
||||
struct tm tm_utc, tm_local;
|
||||
time_t t, time_utc, time_local;
|
||||
|
||||
time (&t);
|
||||
|
||||
gmtime_r (&t, &tm_utc);
|
||||
localtime_r (&t, &tm_local);
|
||||
|
||||
time_utc = mktime (&tm_utc);
|
||||
time_local = mktime (&tm_local);
|
||||
|
||||
return time_utc - time_local;
|
||||
}
|
||||
|
||||
/* Handle time-server tags.
|
||||
*
|
||||
* Sets tags_data->timestamp to the correct time (in unix time).
|
||||
|
@ -1370,7 +1390,7 @@ handle_message_tag_time (const char *time, message_tags_data *tags_data)
|
|||
}
|
||||
|
||||
/* get rid of the local time (mktime() receives a local calendar time) */
|
||||
tags_data->timestamp -= timezone;
|
||||
tags_data->timestamp -= get_timezone();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue