Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IqZV3-0008Lx-Iw for qemu-devel@nongnu.org; Fri, 09 Nov 2007 14:26:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IqZV0-0008KY-1T for qemu-devel@nongnu.org; Fri, 09 Nov 2007 14:26:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IqZUz-0008KF-4J for qemu-devel@nongnu.org; Fri, 09 Nov 2007 14:26:37 -0500 Received: from eastrmmtao107.cox.net ([68.230.240.59]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IqZUy-0003Gn-PN for qemu-devel@nongnu.org; Fri, 09 Nov 2007 14:26:36 -0500 Received: from eastrmimpo02.cox.net ([68.1.16.120]) by eastrmmtao107.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20071109192634.ZIVV4189.eastrmmtao107.cox.net@eastrmimpo02.cox.net> for ; Fri, 9 Nov 2007 14:26:34 -0500 Message-ID: <20071109142635.5NICO.161491.root@eastrmwml12> Date: Fri, 9 Nov 2007 14:26:35 -0500 From: Ben Taylor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] supplement timegm function for Solaris in cutils.c Reply-To: sol10x86@cox.net, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Solaris doesn't have the timegm function, so I found a replacement and wedge it into cutils.c. I found the supplement for timegm in the opensync repository at: http://www.opensync.org/changeset/1769 --- qemu.ORIG/cutils.c 2007-09-16 17:07:49.000000000 -0400 +++ qemu/cutils.c 2007-11-09 14:11:04.005353000 -0500 @@ -81,3 +81,38 @@ *ptr = p; return 1; } + +#ifdef __sun__ +/* + * On solaris no timegm function exists, + * we must implement it here + */ +time_t timegm(struct tm *t) +{ + time_t tl, tb; + struct tm *tg; + + tl = mktime (t); + if (tl == -1) + { + t->tm_hour--; + tl = mktime (t); + if (tl == -1) + return -1; /* can't deal with output from strptime */ + tl += 3600; + } + tg = gmtime (&tl); + tg->tm_isdst = 0; + tb = mktime (tg); + if (tb == -1) + { + tg->tm_hour--; + tb = mktime (tg); + if (tb == -1) + return -1; /* can't deal with output from gmtime */ + tb += 3600; + } + return (tl - (tb - tl)); +} +#endif +