The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: arnold@skeeve.com
To: leah@vuxu.org, chet.ramey@case.edu, arnold@skeeve.com
Cc: tuhs@tuhs.org
Subject: [TUHS] Re: Off topic: BSD timezone function vs. POSIX timezone variable
Date: Thu, 21 Dec 2023 05:12:06 -0700	[thread overview]
Message-ID: <202312211212.3BLCC69X005473@freefriends.org> (raw)
In-Reply-To: <b4334ffb-be25-424c-bba9-b6bfbcae61f4@case.edu>

Thanks to everyone who responded to my question. The answers were
helpful.

Arnold

Chet Ramey <chet.ramey@case.edu> wrote:

> On 12/14/23 10:14 AM, Leah Neukirchen wrote:
> > Aharon Robbins <arnold@skeeve.com> writes:
> > 
> >> Hi All.
> >>
> >> This is a bit off-topic, but people here are likely to know the answer.
> >>
> >> V7 had a timzone function:
> >>
> >> 	char *timezone(int zone, int dst);
> >>
> >> that returned a timezone name.  POSIX has a timezone variable which is
> >> the offset in seconds from UTC.
> >>
> >> The man pages for all of {Net,Free,Open}BSD seem to indicate that both
> >> are available on those systems.
> >>
> >> My question is, how? The declarations for both are given as being in <time.h>.
> >> But don't the symbols in libc.a conflict with each other? How does a programmer
> >> on *BSD choose which version of timezone they will get?
> > 
> > OpenBSD 7.3 only has "extern long timezone" and no timezone(3) function.
> > 
> > FreeBSD 14.0 only has the timezone(3) function (under _BSD_VISIBLE),
> > and doesn't set any variables.
>
> Darwin (macOS) conditionally defines them. If you want POSIX 2003
> compatibility, define __DARWIN_UNIX03 and get
>
> extern long timezone __DARWIN_ALIAS(timezone);
>
> If you don't define that, you get
>
> char *timezone(int, int);
>
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> 		 ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

  reply	other threads:[~2023-12-21 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 13:23 [TUHS] " Aharon Robbins
2023-12-14 15:14 ` [TUHS] " Leah Neukirchen
2023-12-14 15:49   ` Chet Ramey
2023-12-21 12:12     ` arnold [this message]
2023-12-14 17:28 ` Warner Losh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202312211212.3BLCC69X005473@freefriends.org \
    --to=arnold@skeeve.com \
    --cc=chet.ramey@case.edu \
    --cc=leah@vuxu.org \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).