Re: BEAST on FreeBSD: timezone
- From: Tim Janik <timj gtk org>
- To: Rasmus Kaj <kaj e kth se>
- Cc: beast gnome org
- Subject: Re: BEAST on FreeBSD: timezone
- Date: Thu Feb 12 20:36:02 2004
On 11 Feb 2004, Rasmus Kaj wrote:
>
> Hi! I get this warning when building beast on FreeBSD 5.2:
>
> sfitime.c:62: warning: assignment makes integer from pointer without a cast
>
> (See code below.) Later, make check fails to convert a numeric time
> to a string and back to the same value (in testsfi.c:81), and I think
> this warning is what causes that.
>
> It seems that timezone is supposed to be an integer value, but FreeBSD
> can't find the value (and neither can I). Instead it find the
> timezone that is a part of libc, which is a function, so using it as a
> value will yield the pointer value to that function.
>
> So, what are the timezone value supposed to come from?
>
> void
> _sfi_init_time (void)
> {
> static gboolean initialized = FALSE;
> struct timeval tv = { 0, };
> time_t t;
> gint error;
>
> g_assert (initialized++ == FALSE);
>
> tzset ();
> error = gettimeofday (&tv, NULL);
> if (error)
> sfi_info ("gettimeofday() failed: %s", g_strerror (errno));
> t = tv.tv_sec + tv.tv_usec / 1000000;
> localtime (&t);
> gmt_diff = timezone; /* This is sfitime.c:62 */
eek, we need that value to transfrom between UTC times in bse files, and the
local time handling used in the program. i've appended the timezone manual page
from linux, so you know what the value is exactly. then, we'll need to find
a FreeBSD equivalent for that.
> gmt_diff *= SFI_USEC_FACTOR;
> }
>
> --
> Rasmus Kaj ----------------------------------------------- rasmus@kaj.se
> \ An NT server can be run by an idiot, and usually is
---
ciaoTJ
TZSET(3) Linux Programmer's Manual TZSET(3)
NNAAMMEE
tzset, tzname, timezone, daylight - initialize time conversion informa-
tion
SSYYNNOOPPSSIISS
##iinncclluuddee <<ttiimmee..hh>>
vvooiidd ttzzsseett ((vvooiidd));;
eexxtteerrnn cchhaarr **_t_z_n_a_m_e[[22]];;
eexxtteerrnn lloonngg _t_i_m_e_z_o_n_e;;
eexxtteerrnn iinntt _d_a_y_l_i_g_h_t;;
DDEESSCCRRIIPPTTIIOONN
The ttzzsseett(()) function initializes the _t_z_n_a_m_e variable from the TZ envi-
ronment variable. This function is automatically called by the other
time conversion functions that depend on the time zone. In a SysV-like
environment it will also set the variables _t_i_m_e_z_o_n_e (seconds West of
GMT) and _d_a_y_l_i_g_h_t (0 if this time zone does not have any daylight sav-
ings time rules, nonzero if there is a time during the year when day-
light savings time applies).
If the TZ variable does not appear in the environment, the _t_z_n_a_m_e vari-
able is initialized with the best approximation of local wall clock
time, as specified by the ttzzffiillee(5)-format file _l_o_c_a_l_t_i_m_e found in the
system timezone directory (see below). (One also often sees
_/_e_t_c_/_l_o_c_a_l_t_i_m_e used here, a symlink to the right file in the system
timezone directory.)
If the TZ variable does appear in the environment but its value is NULL
or its value cannot be interpreted using any of the formats specified
below, Coordinated Universal Time (UTC) is used.
The value of TZ can be one of three formats. The first format is used
when there is no daylight saving time in the local time zone:
_s_t_d _o_f_f_s_e_t
The _s_t_d string specifies the name of the time zone and must be three or
more alphabetic characters. The _o_f_f_s_e_t string immediately follows _s_t_d
and specifies the time value to be added to the local time to get Coor-
dinated Universal Time (UTC). The _o_f_f_s_e_t is positive if the local time
zone is west of the Prime Meridian and negative if it is east. The
hour must be between 0 and 24, and the minutes and seconds 0 and 59.
The second format is used when there is daylight saving time:
_s_t_d _o_f_f_s_e_t _d_s_t _[_o_f_f_s_e_t_]_,_s_t_a_r_t_[_/_t_i_m_e_]_,_e_n_d_[_/_t_i_m_e_]
There are no spaces in the specification. The initial _s_t_d and _o_f_f_s_e_t
specify the standard time zone, as described above. The _d_s_t string and
_o_f_f_s_e_t specify the name and offset for the corresponding daylight sav-
ings time zone. If the offset is omitted, it defaults to one hour
ahead of standard time.
The _s_t_a_r_t field specifies when daylight savings time goes into effect
and the _e_n_d field specifies when the change is made back to standard
time. These fields may have the following formats:
J_n This specifies the Julian day with _n between 1 and 365. Febru-
ary 29 is never counted even in leap years.
_n This specifies the Julian day with _n between 1 and 365. Febru-
ary 29 is counted in leap years.
M_m._w._d This specifies day _d (0 <= _d <= 6) of week _w (1 <= _w <= 5) of
month _m (1 <= _m <= 12). Week 1 is the first week in which day _d
occurs and week 5 is the last week in which day _d occurs. Day 0
is a Sunday.
The _t_i_m_e fields specify when, in the local time currently in effect,
the change to the other time occurs. If omitted, the default is
02:00:00.
The third format specifies that the time zone information should be
read from a file:
:[filespec]
If the file specification _f_i_l_e_s_p_e_c is omitted, the time zone informa-
tion is read from the file _l_o_c_a_l_t_i_m_e in the system timezone directory,
which nowadays usually is _/_u_s_r_/_s_h_a_r_e_/_z_o_n_e_i_n_f_o. This file is in
ttzzffiillee(5) format. If _f_i_l_e_s_p_e_c is given, it specifies another
ttzzffiillee(5)-format file to read the time zone information from. If _f_i_l_e_-
_s_p_e_c does not begin with a `/', the file specification is relative to
the system timezone directory.
FFIILLEESS
The system time zone directory used depends on the (g)libc version.
Libc4 and libc5 use _/_u_s_r_/_l_i_b_/_z_o_n_e_i_n_f_o, and, since libc-5.4.6, when this
doesn't work, will try _/_u_s_r_/_s_h_a_r_e_/_z_o_n_e_i_n_f_o. Glibc2 will use the envi-
ronment variable TZDIR, when that exists. Its default depends on how
it was installed, but normally is _/_u_s_r_/_s_h_a_r_e_/_z_o_n_e_i_n_f_o.
This timezone directory contains the files
localtime local time zone file
posixrules rules for POSIX-style TZ's
Often _/_e_t_c_/_l_o_c_a_l_t_i_m_e is a symlink to the file _l_o_c_a_l_t_i_m_e or to the cor-
rect time zone file in the system time zone directory.
CCOONNFFOORRMMIINNGG TTOO
SVID 3, POSIX, BSD 4.3
NNOOTTEESS
Note that the variable _d_a_y_l_i_g_h_t does not indicate that daylight savings
time applies right now. It used to give the number of some algorithm
(see the variable _t_z___d_s_t_t_i_m_e in ggeettttiimmeeooffddaayy(2)). It has been obsolete
for many years but is required by SUSv2.
BSD4.3 had a routine _c_h_a_r _*_t_i_m_e_z_o_n_e_(_z_o_n_e_,_d_s_t_) that returned the name of
the time zone corresponding to its first argument (minutes West of
GMT). If the second argument was 0, the standard name was used, other-
wise the daylight savings time version.
SSEEEE AALLSSOO
ddaattee(1), ggeettttiimmeeooffddaayy(2), ttiimmee(2), ccttiimmee(3), ggeetteennvv(3), ttzzffiillee(5)
2001-11-13 TZSET(3)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]