From owner-freebsd-bugs Wed Dec 6 3:40: 7 2000 From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 6 03:40:02 2000 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id F33A537B401 for ; Wed, 6 Dec 2000 03:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id eB6Be1917134; Wed, 6 Dec 2000 03:40:01 -0800 (PST) (envelope-from gnats) Resent-Date: Wed, 6 Dec 2000 03:40:01 -0800 (PST) Resent-Message-Id: <200012061140.eB6Be1917134@freefall.freebsd.org> Resent-From: gnats-admin@FreeBSD.org (GNATS Management) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: gnats-admin@FreeBSD.org, simon@comsys.ntu-kpi.kiev.ua Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 209AD37B400 for ; Wed, 6 Dec 2000 03:38:20 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id eB6BcKI16987; Wed, 6 Dec 2000 03:38:20 -0800 (PST) (envelope-from nobody) Message-Id: <200012061138.eB6BcKI16987@freefall.freebsd.org> Date: Wed, 6 Dec 2000 03:38:20 -0800 (PST) From: simon@comsys.ntu-kpi.kiev.ua Sender: nobody@FreeBSD.org To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/23323: TZ implementation: changes in TZ don't make effect on running process Resent-Sender: gnats@FreeBSD.org Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 23323 >Category: misc >Synopsis: TZ implementation: changes in TZ don't make effect on running process >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: wish >Submitter-Id: current-users >Arrival-Date: Wed Dec 06 03:40:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Andrey Simonenko >Release: 4.1-STABLE i386 >Organization: >Environment: >Description: I found out that implementation of time zone (local time, date, etc.) has one problem. May be I missed something but I think that following will be interesting. If some process calls one of functions which operates with local time, then all other calls of such functions will use time zone got in first call. Example. There is some program with following code: time_t curr_time; struct tm curr_tm; ... for (;;) { curr_time = time((time_t *)0); localtime_r(&curr_time, &curr_tm); .... /* do something which takes some minutes */ } Let current time zone is EST. Program calls localtime_r() and gets local time adjusted to this time zone. Some time latter time zone is changed (for example by tzsetup program). New time zone makes new adjustment for local time. But it will take effect only for programs run after time zone changes. Our example program will still use local time adjustment for time zone EST. This isn't problem for most of programs, but for programs which sensitive for local time it makes some kind of problems. I looked at implementation of localtime_r() (and some other functions like this one) and found out that they call functions tzset() and tzsetwall(). But tzsetwall() remembers that it has been called and doesn't allow to ``call'' itself two times (lcl_is_set variable). May be it is possible to play with environment variable TZ, but I didn't find good solution. If I didn't find function which allows to ``restart'' tzset() and tzsetwall() please tell me. If I'm right then I think that functions tzreset() and tzresetwall() will be useful. Implementations of these functions are quite simple: they should set some variables to initial values and call tzset() and tzsetwall() respectively. What do you think about all this? >How-To-Repeat: I think that functions tzreset() and tzresetwall() will be useful. Implementations of these functions are quite simple: they should set some variables to initial values and call tzset() and tzsetwall() respectively. >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message