Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 1997 21:04:26 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        emulation@freebsd.org, handy@sag.space.lockheed.com
Cc:        wollman@freebsd.org
Subject:   Re: localtime under Linux-emu?
Message-ID:  <199711201004.VAA01710@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I remember sometime back that when linux s/w attempts to find out what
>time it is, it always comes back with ... what, system time?  Anyway, it
>comes back with what the hardware says the time is instead of localtime.  

Linux date (and presumably Linux libc), at least with the Linux
libraries distributed with FreeBSD, searches for localtime in the
following directories in the following order:

	/compat/linux/usr/lib/zoneinfo/
	             /usr/lib/zoneinfo/
	/compat/linux/usr/share/zoneinfo/
	             /usr/share/zoneinfo/

but in FreeBSD the file is in /etc/, and libc only searches for it there.

There seems to be no good standard for this.  zic/THEORY says that the
file is in /etc/zoneinfo/, but it is out of date.  The current timezone
distribution uses "localtime" (relative to the zoneinfo data directory
which is /usr/local/etc/zoneinfo/), and actually documents the full
path to it its version of date.3, ctime.3 and tzset.3.  However, this is
going backwards from FreeBSD's viewpoint.  The zoneinfo data directory
is shareable, so /usr/share is an ideal place for it.  "localtime"
is not shareable, so it doesn't belong in /usr/share, and it is not a
library, so it doesn't belong in /usr/lib.  It may belong in /usr/libdata
instead of /etc.  The FreeBSD man pages are mdoc'ified so they are hard
to compare with the ones in the timezone distribution.

>I seem to remember that it was non-trivial to make Linux figure out what
>time it was, does this still hold true?  

I think it has always been trivial:

	mkdir /compat/linux/usr/lib/zoneinfo
	cp /etc/localtime /compat/linux/usr/lib/zoneinfo

Linux `file' fails similarly.  It looks for "magic" only in
/compat/linux/usr/lib and /usr/lib/.  Linux editors tend to work
because FreeBSD has a backwards compatibility link /etc/termcap ->
/usr/share/misc/termcap.  Things should work better if /compat/linux
contains a full Linux tree.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711201004.VAA01710>