From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,9c72276605786834 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-04-08 16:41:01 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.mel.connect.com.au!news1.optus.net.au!optus!intgwpad.nntp.telstra.net!news-server.bigpond.net.au!not-for-mail From: Mark Garrett Newsgroups: comp.unix.tru64 Subject: Re: Convert local time to gmt time without using TimeZone Env variable Organization: Garetech Computer Solutions Message-ID: References: <3ACD8EF9.221E5F8F@opteway.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022 Date: Sun, 08 Apr 2001 23:41:00 GMT NNTP-Posting-Host: 144.132.244.163 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 986773260 144.132.244.163 (Mon, 09 Apr 2001 09:41:00 EST) NNTP-Posting-Date: Mon, 09 Apr 2001 09:41:00 EST Xref: supernews.google.com comp.unix.tru64:2049 in article 3ACD8EF9.221E5F8F@opteway.com, francois reygagne at freygagne@opteway.com wrote on 06/04/2001 19:40: > The ftcs unix mktime use the function tzset to initialize time > conversion information by setting an environment variable. That is not > thread-safe. > > As I want to work in multi_threaded design with different time-zone, one > > per each thread, I can't use the unix standard fonctions like mktime. I > need a thread-safe function that converts a local-time attached to its > timezone into a GMT time as follow: > > void localtime_to_gmt(const char * timezone, const struct tm > localtime, time_t * gmt_time); > > Is there a sofftware which uses instead of TZ env variable a local time > > zone variable attached to the process to convert a local time to GMT ? > You have always got tm_gmoff to work any tm structure back to GMT and you can call gmtime_r eg. #include #include #include main() { time_t lt; struct tm gmt; lt = time((time_t *) NULL); gmtime_r(<, &gmt); } RTFM Cheers Mark ;)