2012-10-27 13:54:13 -07:00
|
|
|
#!/bin/bash
|
1999-09-21 10:41:52 -04:00
|
|
|
|
2012-11-09 18:12:22 -08:00
|
|
|
PKGVERSION='(tzcode) '
|
2012-07-25 07:46:06 -07:00
|
|
|
TZVERSION=see_Makefile
|
2012-11-12 21:52:35 -08:00
|
|
|
REPORT_BUGS_TO=tz@iana.org
|
1999-09-21 10:41:52 -04:00
|
|
|
|
1996-09-08 15:50:27 -04:00
|
|
|
# Ask the user about the time zone, and output the resulting TZ value to stdout.
|
|
|
|
|
# Interact with the user via stderr and stdin.
|
|
|
|
|
|
2005-07-14 14:06:17 -04:00
|
|
|
# Contributed by Paul Eggert.
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
# Porting notes:
|
|
|
|
|
#
|
2013-10-06 02:11:51 -07:00
|
|
|
# This script requires a Posix-like shell and prefers the extension of a
|
2012-10-27 13:54:13 -07:00
|
|
|
# 'select' statement. The 'select' statement was introduced in the
|
|
|
|
|
# Korn shell and is available in Bash and other shell implementations.
|
|
|
|
|
# If your host lacks both Bash and the Korn shell, you can get their
|
|
|
|
|
# source from one of these locations:
|
1996-09-08 15:50:27 -04:00
|
|
|
#
|
2012-10-27 13:54:13 -07:00
|
|
|
# Bash <http://www.gnu.org/software/bash/bash.html>
|
|
|
|
|
# Korn Shell <http://www.kornshell.com/>
|
|
|
|
|
# Public Domain Korn Shell <http://www.cs.mun.ca/~michael/pdksh/>
|
1996-09-08 15:50:27 -04:00
|
|
|
#
|
2013-10-06 02:11:51 -07:00
|
|
|
# For portability to Solaris 9 /bin/sh this script avoids some POSIX
|
|
|
|
|
# features and common extensions, such as $(...) (which works sometimes
|
|
|
|
|
# but not others), $((...)), and $10.
|
|
|
|
|
#
|
1996-09-08 15:50:27 -04:00
|
|
|
# This script also uses several features of modern awk programs.
|
2012-10-27 13:54:13 -07:00
|
|
|
# If your host lacks awk, or has an old awk that does not conform to Posix,
|
1996-09-08 15:50:27 -04:00
|
|
|
# you can use either of the following free programs instead:
|
|
|
|
|
#
|
2012-10-27 13:54:13 -07:00
|
|
|
# Gawk (GNU awk) <http://www.gnu.org/software/gawk/>
|
|
|
|
|
# mawk <http://invisible-island.net/mawk/>
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Specify default values for environment variables if they are unset.
|
|
|
|
|
: ${AWK=awk}
|
2013-10-06 02:11:51 -07:00
|
|
|
: ${TZDIR=`pwd`}
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
# Check for awk Posix compliance.
|
|
|
|
|
($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
|
|
|
|
|
[ $? = 123 ] || {
|
Don't abuse "`" to mean open quote.
This was appropriate before Unicode, where "`" and "'" often balanced
in visual output, but that's been obsolete for a while.
Overall, single-quote 'like this' instead of `like this', and
double-quote "like this" or (in typeset output) “like this”
instead of ``like this''. While we're at it, fix some glitches
with hyphens versus minus versus en dash versus em dash.
* Makefile ($(MANTXTS)): Use UTF-8 locale to produce *.txt output.
* checktab.awk, tzselect.ksh:
Quote 'like this' in diagnostics, instead of `like this'.
* date.1, newctime.3, newtzset.3, time2posix.3, zic.8 (q, lq, rq):
New macros. Use them for better double-quoting in output.
* workman.sh: Tell Perl that its stdin and stdout are UTF-8.
* NEWS: Document this.
2014-06-15 13:27:37 -07:00
|
|
|
echo >&2 "$0: Sorry, your '$AWK' program is not Posix compatible."
|
1996-09-08 15:50:27 -04:00
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-20 00:57:59 -07:00
|
|
|
coord=
|
|
|
|
|
location_limit=10
|
2014-07-31 15:20:45 -07:00
|
|
|
zonetabtype=zone1970
|
2013-08-20 00:57:59 -07:00
|
|
|
|
2013-09-10 17:43:02 -07:00
|
|
|
usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT]
|
2009-01-14 10:56:24 -05:00
|
|
|
Select a time zone interactively.
|
2013-08-20 00:57:59 -07:00
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
|
|
-c COORD
|
|
|
|
|
Instead of asking for continent and then country and then city,
|
|
|
|
|
ask for selection from time zones whose largest cities
|
|
|
|
|
are closest to the location with geographical coordinates COORD.
|
|
|
|
|
COORD should use ISO 6709 notation, for example, '-c +4852+00220'
|
2013-08-22 06:33:38 -07:00
|
|
|
for Paris (in degrees and minutes, North and East), or
|
|
|
|
|
'-c -35-058' for Buenos Aires (in degrees, South and West).
|
2013-08-20 00:57:59 -07:00
|
|
|
|
|
|
|
|
-n LIMIT
|
|
|
|
|
Display at most LIMIT locations when -c is used (default $location_limit).
|
|
|
|
|
|
|
|
|
|
--version
|
|
|
|
|
Output version information.
|
|
|
|
|
|
|
|
|
|
--help
|
|
|
|
|
Output this help.
|
2009-01-14 10:56:24 -05:00
|
|
|
|
2013-08-16 12:19:42 -07:00
|
|
|
Report bugs to $REPORT_BUGS_TO."
|
|
|
|
|
|
2013-10-06 02:11:51 -07:00
|
|
|
# Ask the user to select from the function's arguments,
|
|
|
|
|
# and assign the selected argument to the variable 'select_result'.
|
|
|
|
|
# Exit on EOF or I/O error. Use the shell's 'select' builtin if available,
|
|
|
|
|
# falling back on a less-nice but portable substitute otherwise.
|
|
|
|
|
if
|
|
|
|
|
case $BASH_VERSION in
|
|
|
|
|
?*) : ;;
|
|
|
|
|
'')
|
|
|
|
|
# '; exit' should be redundant, but Dash doesn't properly fail without it.
|
2014-07-22 20:18:49 -07:00
|
|
|
(eval 'set --; select x; do break; done; exit') </dev/null 2>/dev/null
|
2013-10-06 02:11:51 -07:00
|
|
|
esac
|
|
|
|
|
then
|
|
|
|
|
# Do this inside 'eval', as otherwise the shell might exit when parsing it
|
|
|
|
|
# even though it is never executed.
|
|
|
|
|
eval '
|
|
|
|
|
doselect() {
|
|
|
|
|
select select_result
|
|
|
|
|
do
|
|
|
|
|
case $select_result in
|
|
|
|
|
"") echo >&2 "Please enter a number in range." ;;
|
|
|
|
|
?*) break
|
|
|
|
|
esac
|
|
|
|
|
done || exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Work around a bug in bash 1.14.7 and earlier, where $PS3 is sent to stdout.
|
|
|
|
|
case $BASH_VERSION in
|
|
|
|
|
[01].*)
|
|
|
|
|
case `echo 1 | (select x in x; do break; done) 2>/dev/null` in
|
|
|
|
|
?*) PS3=
|
|
|
|
|
esac
|
|
|
|
|
esac
|
|
|
|
|
'
|
|
|
|
|
else
|
|
|
|
|
doselect() {
|
|
|
|
|
# Field width of the prompt numbers.
|
|
|
|
|
select_width=`expr $# : '.*'`
|
|
|
|
|
|
|
|
|
|
select_i=
|
|
|
|
|
|
|
|
|
|
while :
|
|
|
|
|
do
|
|
|
|
|
case $select_i in
|
|
|
|
|
'')
|
|
|
|
|
select_i=0
|
|
|
|
|
for select_word
|
|
|
|
|
do
|
|
|
|
|
select_i=`expr $select_i + 1`
|
2013-10-06 12:28:30 -07:00
|
|
|
printf >&2 "%${select_width}d) %s\\n" $select_i "$select_word"
|
2013-10-06 02:11:51 -07:00
|
|
|
done ;;
|
|
|
|
|
*[!0-9]*)
|
|
|
|
|
echo >&2 'Please enter a number in range.' ;;
|
|
|
|
|
*)
|
|
|
|
|
if test 1 -le $select_i && test $select_i -le $#; then
|
|
|
|
|
shift `expr $select_i - 1`
|
|
|
|
|
select_result=$1
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
echo >&2 'Please enter a number in range.'
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# Prompt and read input.
|
2013-10-06 12:28:30 -07:00
|
|
|
printf >&2 %s "${PS3-#? }"
|
2013-10-06 02:11:51 -07:00
|
|
|
read select_i || exit
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
|
2014-08-11 17:13:25 -07:00
|
|
|
while getopts c:n:t:-: opt
|
2013-08-16 12:19:42 -07:00
|
|
|
do
|
|
|
|
|
case $opt$OPTARG in
|
2013-08-20 00:57:59 -07:00
|
|
|
c*)
|
|
|
|
|
coord=$OPTARG ;;
|
|
|
|
|
n*)
|
|
|
|
|
location_limit=$OPTARG ;;
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
t*) # Undocumented option, used for developer testing.
|
|
|
|
|
zonetabtype=$OPTARG ;;
|
2013-08-16 12:19:42 -07:00
|
|
|
-help)
|
|
|
|
|
exec echo "$usage" ;;
|
|
|
|
|
-version)
|
|
|
|
|
exec echo "tzselect $PKGVERSION$TZVERSION" ;;
|
|
|
|
|
-*)
|
|
|
|
|
echo >&2 "$0: -$opt$OPTARG: unknown option; try '$0 --help'"; exit 1 ;;
|
|
|
|
|
*)
|
|
|
|
|
echo >&2 "$0: try '$0 --help'"; exit 1 ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2013-10-06 02:11:51 -07:00
|
|
|
shift `expr $OPTIND - 1`
|
2013-08-16 12:19:42 -07:00
|
|
|
case $# in
|
|
|
|
|
0) ;;
|
|
|
|
|
*) echo >&2 "$0: $1: unknown argument"; exit 1 ;;
|
|
|
|
|
esac
|
2009-01-14 10:56:24 -05:00
|
|
|
|
1996-09-08 15:50:27 -04:00
|
|
|
# Make sure the tables are readable.
|
|
|
|
|
TZ_COUNTRY_TABLE=$TZDIR/iso3166.tab
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
TZ_ZONE_TABLE=$TZDIR/$zonetabtype.tab
|
1996-09-08 15:50:27 -04:00
|
|
|
for f in $TZ_COUNTRY_TABLE $TZ_ZONE_TABLE
|
|
|
|
|
do
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
<"$f" || {
|
1996-09-08 15:50:27 -04:00
|
|
|
echo >&2 "$0: time zone files are not set up correctly"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
newline='
|
|
|
|
|
'
|
|
|
|
|
IFS=$newline
|
|
|
|
|
|
|
|
|
|
|
2013-08-20 00:57:59 -07:00
|
|
|
# Awk script to read a time zone table and output the same table,
|
|
|
|
|
# with each column preceded by its distance from 'here'.
|
|
|
|
|
output_distances='
|
|
|
|
|
BEGIN {
|
|
|
|
|
FS = "\t"
|
|
|
|
|
while (getline <TZ_COUNTRY_TABLE)
|
|
|
|
|
if ($0 ~ /^[^#]/)
|
|
|
|
|
country[$1] = $2
|
|
|
|
|
country["US"] = "US" # Otherwise the strings get too long.
|
|
|
|
|
}
|
2014-08-11 18:41:32 -07:00
|
|
|
function abs(x) {
|
|
|
|
|
return x < 0 ? -x : x;
|
|
|
|
|
}
|
|
|
|
|
function min(x, y) {
|
|
|
|
|
return x < y ? x : y;
|
|
|
|
|
}
|
|
|
|
|
function convert_coord(coord, deg, minute, ilen, sign, sec) {
|
2013-08-20 20:22:07 -07:00
|
|
|
if (coord ~ /^[-+]?[0-9]?[0-9][0-9][0-9][0-9][0-9][0-9]([^0-9]|$)/) {
|
|
|
|
|
degminsec = coord
|
|
|
|
|
intdeg = degminsec < 0 ? -int(-degminsec / 10000) : int(degminsec / 10000)
|
|
|
|
|
minsec = degminsec - intdeg * 10000
|
|
|
|
|
intmin = minsec < 0 ? -int(-minsec / 100) : int(minsec / 100)
|
|
|
|
|
sec = minsec - intmin * 100
|
|
|
|
|
deg = (intdeg * 3600 + intmin * 60 + sec) / 3600
|
|
|
|
|
} else if (coord ~ /^[-+]?[0-9]?[0-9][0-9][0-9][0-9]([^0-9]|$)/) {
|
|
|
|
|
degmin = coord
|
|
|
|
|
intdeg = degmin < 0 ? -int(-degmin / 100) : int(degmin / 100)
|
2014-08-11 18:41:32 -07:00
|
|
|
minute = degmin - intdeg * 100
|
|
|
|
|
deg = (intdeg * 60 + minute) / 60
|
2013-08-20 20:22:07 -07:00
|
|
|
} else
|
|
|
|
|
deg = coord
|
|
|
|
|
return deg * 0.017453292519943296
|
2013-08-20 00:57:59 -07:00
|
|
|
}
|
|
|
|
|
function convert_latitude(coord) {
|
|
|
|
|
match(coord, /..*[-+]/)
|
2013-08-20 20:22:07 -07:00
|
|
|
return convert_coord(substr(coord, 1, RLENGTH - 1))
|
2013-08-20 00:57:59 -07:00
|
|
|
}
|
|
|
|
|
function convert_longitude(coord) {
|
|
|
|
|
match(coord, /..*[-+]/)
|
2013-08-20 20:22:07 -07:00
|
|
|
return convert_coord(substr(coord, RLENGTH))
|
2013-08-20 00:57:59 -07:00
|
|
|
}
|
|
|
|
|
# Great-circle distance between points with given latitude and longitude.
|
|
|
|
|
# Inputs and output are in radians. This uses the great-circle special
|
|
|
|
|
# case of the Vicenty formula for distances on ellipsoids.
|
2014-08-11 18:41:32 -07:00
|
|
|
function gcdist(lat1, long1, lat2, long2, dlong, x, y, num, denom) {
|
2013-08-20 00:57:59 -07:00
|
|
|
dlong = long2 - long1
|
2014-11-25 18:03:19 +01:00
|
|
|
x = cos(lat2) * sin(dlong)
|
|
|
|
|
y = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dlong)
|
|
|
|
|
num = sqrt(x * x + y * y)
|
|
|
|
|
denom = sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(dlong)
|
2013-08-20 00:57:59 -07:00
|
|
|
return atan2(num, denom)
|
|
|
|
|
}
|
2014-08-11 18:41:32 -07:00
|
|
|
# Parallel distance between points with given latitude and longitude.
|
|
|
|
|
# This is the product of the longitude difference and the cosine
|
|
|
|
|
# of the latitude of the point that is further from the equator.
|
|
|
|
|
# I.e., it considers longitudes to be further apart if they are
|
|
|
|
|
# nearer the equator.
|
|
|
|
|
function pardist(lat1, long1, lat2, long2) {
|
2014-11-25 18:03:19 +01:00
|
|
|
return abs(long1 - long2) * min(cos(lat1), cos(lat2))
|
2014-08-11 18:41:32 -07:00
|
|
|
}
|
|
|
|
|
# The distance function is the sum of the great-circle distance and
|
|
|
|
|
# the parallel distance. It could be weighted.
|
|
|
|
|
function dist(lat1, long1, lat2, long2) {
|
2014-11-25 18:03:19 +01:00
|
|
|
return gcdist(lat1, long1, lat2, long2) + pardist(lat1, long1, lat2, long2)
|
2014-08-11 18:41:32 -07:00
|
|
|
}
|
2013-08-20 00:57:59 -07:00
|
|
|
BEGIN {
|
|
|
|
|
coord_lat = convert_latitude(coord)
|
|
|
|
|
coord_long = convert_longitude(coord)
|
|
|
|
|
}
|
|
|
|
|
/^[^#]/ {
|
|
|
|
|
here_lat = convert_latitude($2)
|
|
|
|
|
here_long = convert_longitude($2)
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
line = $1 "\t" $2 "\t" $3
|
|
|
|
|
sep = "\t"
|
|
|
|
|
ncc = split($1, cc, /,/)
|
|
|
|
|
for (i = 1; i <= ncc; i++) {
|
|
|
|
|
line = line sep country[cc[i]]
|
|
|
|
|
sep = ", "
|
|
|
|
|
}
|
2013-08-20 00:57:59 -07:00
|
|
|
if (NF == 4)
|
|
|
|
|
line = line " - " $4
|
|
|
|
|
printf "%g\t%s\n", dist(coord_lat, coord_long, here_lat, here_long), line
|
|
|
|
|
}
|
|
|
|
|
'
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
# Begin the main loop. We come back here if the user wants to retry.
|
|
|
|
|
while
|
|
|
|
|
|
|
|
|
|
echo >&2 'Please identify a location' \
|
|
|
|
|
'so that time zone rules can be set correctly.'
|
|
|
|
|
|
|
|
|
|
continent=
|
|
|
|
|
country=
|
|
|
|
|
region=
|
|
|
|
|
|
2013-08-20 00:57:59 -07:00
|
|
|
case $coord in
|
|
|
|
|
?*)
|
|
|
|
|
continent=coord;;
|
|
|
|
|
'')
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
# Ask the user for continent or ocean.
|
|
|
|
|
|
2013-08-20 00:57:59 -07:00
|
|
|
echo >&2 'Please select a continent, ocean, "coord", or "TZ".'
|
1996-09-08 15:50:27 -04:00
|
|
|
|
2013-10-06 02:11:51 -07:00
|
|
|
quoted_continents=`
|
2013-10-06 02:24:36 -07:00
|
|
|
$AWK '
|
|
|
|
|
BEGIN { FS = "\t" }
|
2013-08-20 12:00:07 -07:00
|
|
|
/^[^#]/ {
|
|
|
|
|
entry = substr($3, 1, index($3, "/") - 1)
|
|
|
|
|
if (entry == "America")
|
|
|
|
|
entry = entry "s"
|
|
|
|
|
if (entry ~ /^(Arctic|Atlantic|Indian|Pacific)$/)
|
|
|
|
|
entry = entry " Ocean"
|
|
|
|
|
printf "'\''%s'\''\n", entry
|
|
|
|
|
}
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
' <"$TZ_ZONE_TABLE" |
|
2013-08-20 12:00:07 -07:00
|
|
|
sort -u |
|
|
|
|
|
tr '\n' ' '
|
|
|
|
|
echo ''
|
2013-10-06 02:11:51 -07:00
|
|
|
`
|
2013-08-20 12:00:07 -07:00
|
|
|
|
|
|
|
|
eval '
|
2013-10-06 02:11:51 -07:00
|
|
|
doselect '"$quoted_continents"' \
|
2013-08-20 12:00:07 -07:00
|
|
|
"coord - I want to use geographical coordinates." \
|
|
|
|
|
"TZ - I want to specify the time zone using the Posix TZ format."
|
2013-10-06 02:11:51 -07:00
|
|
|
continent=$select_result
|
|
|
|
|
case $continent in
|
|
|
|
|
Americas) continent=America;;
|
|
|
|
|
*" "*) continent=`expr "$continent" : '\''\([^ ]*\)'\''`
|
|
|
|
|
esac
|
2013-08-20 12:00:07 -07:00
|
|
|
'
|
2013-08-20 00:57:59 -07:00
|
|
|
esac
|
|
|
|
|
|
1996-09-08 15:50:27 -04:00
|
|
|
case $continent in
|
2013-08-20 00:57:59 -07:00
|
|
|
TZ)
|
1996-09-08 15:50:27 -04:00
|
|
|
# Ask the user for a Posix TZ string. Check that it conforms.
|
|
|
|
|
while
|
|
|
|
|
echo >&2 'Please enter the desired value' \
|
|
|
|
|
'of the TZ environment variable.'
|
|
|
|
|
echo >&2 'For example, GST-10 is a zone named GST' \
|
|
|
|
|
'that is 10 hours ahead (east) of UTC.'
|
|
|
|
|
read TZ
|
|
|
|
|
$AWK -v TZ="$TZ" 'BEGIN {
|
|
|
|
|
tzname = "[^-+,0-9][^-+,0-9][^-+,0-9]+"
|
|
|
|
|
time = "[0-2]?[0-9](:[0-5][0-9](:[0-5][0-9])?)?"
|
|
|
|
|
offset = "[-+]?" time
|
2014-11-22 15:03:10 +01:00
|
|
|
date = "(J?[0-9]+|M[0-9]+\\.[0-9]+\\.[0-9]+)"
|
1996-09-08 15:50:27 -04:00
|
|
|
datetime = "," date "(/" time ")?"
|
|
|
|
|
tzpattern = "^(:.*|" tzname offset "(" tzname \
|
|
|
|
|
"(" offset ")?(" datetime datetime ")?)?)$"
|
|
|
|
|
if (TZ ~ tzpattern) exit 1
|
|
|
|
|
exit 0
|
|
|
|
|
}'
|
|
|
|
|
do
|
Don't abuse "`" to mean open quote.
This was appropriate before Unicode, where "`" and "'" often balanced
in visual output, but that's been obsolete for a while.
Overall, single-quote 'like this' instead of `like this', and
double-quote "like this" or (in typeset output) “like this”
instead of ``like this''. While we're at it, fix some glitches
with hyphens versus minus versus en dash versus em dash.
* Makefile ($(MANTXTS)): Use UTF-8 locale to produce *.txt output.
* checktab.awk, tzselect.ksh:
Quote 'like this' in diagnostics, instead of `like this'.
* date.1, newctime.3, newtzset.3, time2posix.3, zic.8 (q, lq, rq):
New macros. Use them for better double-quoting in output.
* workman.sh: Tell Perl that its stdin and stdout are UTF-8.
* NEWS: Document this.
2014-06-15 13:27:37 -07:00
|
|
|
echo >&2 "'$TZ' is not a conforming" \
|
1996-09-08 15:50:27 -04:00
|
|
|
'Posix time zone string.'
|
|
|
|
|
done
|
|
|
|
|
TZ_for_date=$TZ;;
|
|
|
|
|
*)
|
2013-08-20 00:57:59 -07:00
|
|
|
case $continent in
|
|
|
|
|
coord)
|
|
|
|
|
case $coord in
|
|
|
|
|
'')
|
|
|
|
|
echo >&2 'Please enter coordinates' \
|
|
|
|
|
'in ISO 6709 notation.'
|
|
|
|
|
echo >&2 'For example, +4042-07403 stands for'
|
|
|
|
|
echo >&2 '40 degrees 42 minutes north,' \
|
|
|
|
|
'74 degrees 3 minutes west.'
|
|
|
|
|
read coord;;
|
|
|
|
|
esac
|
2013-10-06 02:11:51 -07:00
|
|
|
distance_table=`$AWK \
|
2013-08-20 00:57:59 -07:00
|
|
|
-v coord="$coord" \
|
|
|
|
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
"$output_distances" <"$TZ_ZONE_TABLE" |
|
2013-08-20 00:57:59 -07:00
|
|
|
sort -n |
|
|
|
|
|
sed "${location_limit}q"
|
2013-10-06 02:11:51 -07:00
|
|
|
`
|
|
|
|
|
regions=`echo "$distance_table" | $AWK '
|
2013-08-20 00:57:59 -07:00
|
|
|
BEGIN { FS = "\t" }
|
|
|
|
|
{ print $NF }
|
2013-10-06 02:11:51 -07:00
|
|
|
'`
|
2013-08-20 00:57:59 -07:00
|
|
|
echo >&2 'Please select one of the following' \
|
|
|
|
|
'time zone regions,'
|
|
|
|
|
echo >&2 'listed roughly in increasing order' \
|
|
|
|
|
"of distance from $coord".
|
2013-10-06 02:11:51 -07:00
|
|
|
doselect $regions
|
|
|
|
|
region=$select_result
|
|
|
|
|
TZ=`echo "$distance_table" | $AWK -v region="$region" '
|
2013-08-20 00:57:59 -07:00
|
|
|
BEGIN { FS="\t" }
|
|
|
|
|
$NF == region { print $4 }
|
2013-10-06 02:11:51 -07:00
|
|
|
'`
|
2013-08-20 00:57:59 -07:00
|
|
|
;;
|
|
|
|
|
*)
|
1996-09-08 15:50:27 -04:00
|
|
|
# Get list of names of countries in the continent or ocean.
|
2013-10-06 02:24:36 -07:00
|
|
|
countries=`$AWK \
|
1996-09-08 15:50:27 -04:00
|
|
|
-v continent="$continent" \
|
|
|
|
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
|
|
|
|
'
|
2013-10-06 02:24:36 -07:00
|
|
|
BEGIN { FS = "\t" }
|
1996-09-08 15:50:27 -04:00
|
|
|
/^#/ { next }
|
|
|
|
|
$3 ~ ("^" continent "/") {
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
ncc = split($1, cc, /,/)
|
|
|
|
|
for (i = 1; i <= ncc; i++)
|
|
|
|
|
if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i]
|
1996-09-08 15:50:27 -04:00
|
|
|
}
|
|
|
|
|
END {
|
|
|
|
|
while (getline <TZ_COUNTRY_TABLE) {
|
|
|
|
|
if ($0 !~ /^#/) cc_name[$1] = $2
|
|
|
|
|
}
|
|
|
|
|
for (i = 1; i <= ccs; i++) {
|
|
|
|
|
country = cc_list[i]
|
|
|
|
|
if (cc_name[country]) {
|
|
|
|
|
country = cc_name[country]
|
|
|
|
|
}
|
|
|
|
|
print country
|
|
|
|
|
}
|
|
|
|
|
}
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
' <"$TZ_ZONE_TABLE" | sort -f`
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# If there's more than one country, ask the user which one.
|
|
|
|
|
case $countries in
|
|
|
|
|
*"$newline"*)
|
2013-08-20 00:57:59 -07:00
|
|
|
echo >&2 'Please select a country' \
|
|
|
|
|
'whose clocks agree with yours.'
|
2013-10-06 02:11:51 -07:00
|
|
|
doselect $countries
|
|
|
|
|
country=$select_result;;
|
1996-09-08 15:50:27 -04:00
|
|
|
*)
|
|
|
|
|
country=$countries
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get list of names of time zone rule regions in the country.
|
2013-10-06 02:24:36 -07:00
|
|
|
regions=`$AWK \
|
1996-09-08 15:50:27 -04:00
|
|
|
-v country="$country" \
|
|
|
|
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
|
|
|
|
'
|
|
|
|
|
BEGIN {
|
2013-10-06 02:24:36 -07:00
|
|
|
FS = "\t"
|
1996-09-08 15:50:27 -04:00
|
|
|
cc = country
|
|
|
|
|
while (getline <TZ_COUNTRY_TABLE) {
|
|
|
|
|
if ($0 !~ /^#/ && country == $2) {
|
|
|
|
|
cc = $1
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
$1 ~ cc { print $4 }
|
|
|
|
|
' <"$TZ_ZONE_TABLE"`
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# If there's more than one region, ask the user which one.
|
|
|
|
|
case $regions in
|
|
|
|
|
*"$newline"*)
|
|
|
|
|
echo >&2 'Please select one of the following' \
|
|
|
|
|
'time zone regions.'
|
2013-10-06 02:11:51 -07:00
|
|
|
doselect $regions
|
|
|
|
|
region=$select_result;;
|
1996-09-08 15:50:27 -04:00
|
|
|
*)
|
|
|
|
|
region=$regions
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# Determine TZ from country and region.
|
2013-10-06 02:24:36 -07:00
|
|
|
TZ=`$AWK \
|
1996-09-08 15:50:27 -04:00
|
|
|
-v country="$country" \
|
|
|
|
|
-v region="$region" \
|
|
|
|
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
|
|
|
|
'
|
|
|
|
|
BEGIN {
|
2013-10-06 02:24:36 -07:00
|
|
|
FS = "\t"
|
1996-09-08 15:50:27 -04:00
|
|
|
cc = country
|
|
|
|
|
while (getline <TZ_COUNTRY_TABLE) {
|
|
|
|
|
if ($0 !~ /^#/ && country == $2) {
|
|
|
|
|
cc = $1
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
$1 ~ cc && $4 == region { print $3 }
|
|
|
|
|
' <"$TZ_ZONE_TABLE"`
|
2013-08-20 00:57:59 -07:00
|
|
|
esac
|
1996-09-08 15:50:27 -04:00
|
|
|
|
|
|
|
|
# Make sure the corresponding zoneinfo file exists.
|
|
|
|
|
TZ_for_date=$TZDIR/$TZ
|
New file time.tab, superseding zone.tab
It allows multiple country codes per zone. Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
2014-07-18 13:16:10 -07:00
|
|
|
<"$TZ_for_date" || {
|
1996-09-08 15:50:27 -04:00
|
|
|
echo >&2 "$0: time zone files are not set up correctly"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use the proposed TZ to output the current date relative to UTC.
|
|
|
|
|
# Loop until they agree in seconds.
|
|
|
|
|
# Give up after 8 unsuccessful tries.
|
|
|
|
|
|
|
|
|
|
extra_info=
|
|
|
|
|
for i in 1 2 3 4 5 6 7 8
|
|
|
|
|
do
|
2013-10-06 02:11:51 -07:00
|
|
|
TZdate=`LANG=C TZ="$TZ_for_date" date`
|
|
|
|
|
UTdate=`LANG=C TZ=UTC0 date`
|
|
|
|
|
TZsec=`expr "$TZdate" : '.*:\([0-5][0-9]\)'`
|
|
|
|
|
UTsec=`expr "$UTdate" : '.*:\([0-5][0-9]\)'`
|
1996-09-08 15:50:27 -04:00
|
|
|
case $TZsec in
|
|
|
|
|
$UTsec)
|
|
|
|
|
extra_info="
|
|
|
|
|
Local time is now: $TZdate.
|
|
|
|
|
Universal Time is now: $UTdate."
|
|
|
|
|
break
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Output TZ info and ask the user to confirm.
|
|
|
|
|
|
|
|
|
|
echo >&2 ""
|
|
|
|
|
echo >&2 "The following information has been given:"
|
|
|
|
|
echo >&2 ""
|
2013-08-20 00:57:59 -07:00
|
|
|
case $country%$region%$coord in
|
|
|
|
|
?*%?*%) echo >&2 " $country$newline $region";;
|
|
|
|
|
?*%%) echo >&2 " $country";;
|
|
|
|
|
%?*%?*) echo >&2 " coord $coord$newline $region";;
|
|
|
|
|
%%?*) echo >&2 " coord $coord";;
|
1996-09-08 15:50:27 -04:00
|
|
|
+) echo >&2 " TZ='$TZ'"
|
|
|
|
|
esac
|
|
|
|
|
echo >&2 ""
|
|
|
|
|
echo >&2 "Therefore TZ='$TZ' will be used.$extra_info"
|
|
|
|
|
echo >&2 "Is the above information OK?"
|
|
|
|
|
|
2013-10-06 02:11:51 -07:00
|
|
|
doselect Yes No
|
|
|
|
|
ok=$select_result
|
1996-09-08 15:50:27 -04:00
|
|
|
case $ok in
|
|
|
|
|
Yes) break
|
|
|
|
|
esac
|
2013-08-20 00:57:59 -07:00
|
|
|
do coord=
|
1996-09-08 15:50:27 -04:00
|
|
|
done
|
|
|
|
|
|
1999-09-21 10:29:00 -04:00
|
|
|
case $SHELL in
|
|
|
|
|
*csh) file=.login line="setenv TZ '$TZ'";;
|
|
|
|
|
*) file=.profile line="TZ='$TZ'; export TZ"
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
echo >&2 "
|
|
|
|
|
You can make this change permanent for yourself by appending the line
|
|
|
|
|
$line
|
|
|
|
|
to the file '$file' in your home directory; then log out and log in again.
|
|
|
|
|
|
|
|
|
|
Here is that TZ value again, this time on standard output so that you
|
|
|
|
|
can use the $0 command in shell scripts:"
|
|
|
|
|
|
1996-09-08 15:50:27 -04:00
|
|
|
echo "$TZ"
|