mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Show time zone name and offset in clock border if TZ environment
variable is set. This is useful when running multiple clocks in different time zones. From James Russell Stickney (jrs AT outband.net), tweaked by me. Input & OK kn
This commit is contained in:
parent
5958b96b56
commit
94089c8a8f
@ -1,8 +1,8 @@
|
|||||||
.\" $OpenBSD: grdc.6,v 1.12 2019/02/06 15:02:01 schwarze Exp $
|
.\" $OpenBSD: grdc.6,v 1.13 2022/09/17 10:32:05 florian Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright 2002 Amos Shapir. Public domain.
|
.\" Copyright 2002 Amos Shapir. Public domain.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: February 6 2019 $
|
.Dd $Mdocdate: September 17 2022 $
|
||||||
.Dt GRDC 6
|
.Dt GRDC 6
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -30,6 +30,15 @@ skips seconds.
|
|||||||
Pressing the
|
Pressing the
|
||||||
.Sq q
|
.Sq q
|
||||||
key exits the program.
|
key exits the program.
|
||||||
|
.Sh ENVIRONMENT
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ev TZ
|
||||||
|
The time zone to use for displaying the time.
|
||||||
|
It is specified as a pathname relative to
|
||||||
|
.Pa /usr/share/zoneinfo .
|
||||||
|
If this variable is not set, the time zone is determined based on
|
||||||
|
.Pa /etc/localtime .
|
||||||
|
.El
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An -nosplit
|
.An -nosplit
|
||||||
.An Amos Shapir ,
|
.An Amos Shapir ,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: grdc.c,v 1.34 2021/10/23 11:22:49 mestre Exp $ */
|
/* $OpenBSD: grdc.c,v 1.35 2022/09/17 10:32:05 florian Exp $ */
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2002 Amos Shapir. Public domain.
|
* Copyright 2002 Amos Shapir. Public domain.
|
||||||
@ -78,6 +78,9 @@ main(int argc, char *argv[])
|
|||||||
int xbase;
|
int xbase;
|
||||||
int ybase;
|
int ybase;
|
||||||
int wintoosmall;
|
int wintoosmall;
|
||||||
|
char *tz;
|
||||||
|
|
||||||
|
tz = getenv("TZ");
|
||||||
|
|
||||||
scrol = wintoosmall = 0;
|
scrol = wintoosmall = 0;
|
||||||
while ((i = getopt(argc, argv, "sh")) != -1) {
|
while ((i = getopt(argc, argv, "sh")) != -1) {
|
||||||
@ -139,6 +142,16 @@ main(int argc, char *argv[])
|
|||||||
alarm(n);
|
alarm(n);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
mask = 0;
|
||||||
|
tm = localtime(&now.tv_sec);
|
||||||
|
set(tm->tm_sec % 10, 0);
|
||||||
|
set(tm->tm_sec / 10, 4);
|
||||||
|
set(tm->tm_min % 10, 10);
|
||||||
|
set(tm->tm_min / 10, 14);
|
||||||
|
set(tm->tm_hour % 10, 20);
|
||||||
|
set(tm->tm_hour / 10, 24);
|
||||||
|
set(10, 7);
|
||||||
|
set(10, 17);
|
||||||
if (sigwinched) {
|
if (sigwinched) {
|
||||||
sigwinched = 0;
|
sigwinched = 0;
|
||||||
wintoosmall = 0;
|
wintoosmall = 0;
|
||||||
@ -171,21 +184,17 @@ main(int argc, char *argv[])
|
|||||||
move(ybase, xbase + XLENGTH);
|
move(ybase, xbase + XLENGTH);
|
||||||
vline(ACS_VLINE, YDEPTH);
|
vline(ACS_VLINE, YDEPTH);
|
||||||
|
|
||||||
|
if (tz != NULL) {
|
||||||
|
move(ybase - 1, xbase);
|
||||||
|
printw("[ %s %+d ]", tz,
|
||||||
|
tm->tm_gmtoff / 60 / 60 );
|
||||||
|
}
|
||||||
|
|
||||||
attrset(COLOR_PAIR(2));
|
attrset(COLOR_PAIR(2));
|
||||||
}
|
}
|
||||||
for (k = 0; k < 6; k++)
|
for (k = 0; k < 6; k++)
|
||||||
old[k] = 0;
|
old[k] = 0;
|
||||||
}
|
}
|
||||||
mask = 0;
|
|
||||||
tm = localtime(&now.tv_sec);
|
|
||||||
set(tm->tm_sec % 10, 0);
|
|
||||||
set(tm->tm_sec / 10, 4);
|
|
||||||
set(tm->tm_min % 10, 10);
|
|
||||||
set(tm->tm_min / 10, 14);
|
|
||||||
set(tm->tm_hour % 10, 20);
|
|
||||||
set(tm->tm_hour / 10, 24);
|
|
||||||
set(10, 7);
|
|
||||||
set(10, 17);
|
|
||||||
if (wintoosmall) {
|
if (wintoosmall) {
|
||||||
move(0, 0);
|
move(0, 0);
|
||||||
printw("%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
|
printw("%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
|
||||||
|
Loading…
Reference in New Issue
Block a user