Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 62228 invoked by uid 500); 28 Jun 2001 22:48:00 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 62212 invoked from network); 28 Jun 2001 22:47:57 -0000 Message-ID: <3B3BB404.6010809@xbc.nu> Date: Fri, 29 Jun 2001 00:47:32 +0200 From: Branko =?ISO-8859-2?Q?=C8ibej?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1) Gecko/20010607 X-Accept-Language: sl, en-gb, en MIME-Version: 1.0 To: dev@apr.apache.org Subject: Re: apr_implode_time and time zones References: <3B3AA827.1000508@xbc.nu> <002701c0fff2$b8ec5b40$296dbcc1@VAIO> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N David Reid wrote: >AFAICT there's no way to >figure out how to set the gmt offset on Solaris when passing in a value, > After two minutes of manpage reading and one minute of coding: #include #include int main (void) { time_t t1, t2; struct tm tm; t1 = time(0); tm = *gmtime(&t1); t2 = mktime(&tm); printf("GMT offset = %ld\n", (long) difftime(t1, t2)); return 0; } All of this code uses only standard ANSI time functions. And the results: $ cc -o gmtoff gmtoff.c $ TZ=PST8PDT ./gmtoff GMT offset = -28800 $ TZ=CET-1DST ./gmtoff GMT offset = 3600 $ TZ=GMT ./gmtoff GMT offset = 0 That's on sparc-sun-solaris2.6, hppa1.1-hp-hpux10.20, and i686-pc-linux-gnu. I fail to see when this wouldn't work. Would this be a satisfactory solution on systems that don't have a tm_gmtoff field? -- Brane �ibej home: http://www.xbc.nu/brane/ work: http://www.hermes-softlab.com/ ACM : http://www.acm.org/