delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/09/22:33:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 10 Feb 2004 14:32:48 +1100 (EST)
From: King Lung Chiu <csklc AT farrer DOT hpc DOT csiro DOT au>
To: Cygwin Mailing List <cygwin AT cygwin DOT com>
Subject: definition of 'timezone'
Message-ID: <Pine.LNX.4.44.0402101425080.5936-100000@farrer.hpc.csiro.au>
MIME-Version: 1.0

Hi,

I'm trying to port some code that uses 'timezone' from time.h:

  ...
  time_t utime;
  struct tm tms;
  ...
  utime = utime - timezone + tms.tm_isdst*3600;
  ...

but I get compilation error because the code expects timezone to be a long 
(as is on Linux) but in cygwin it's actually a function that returns a 
char*:

 ../../src/client/store_in_cc.c: In function `utc2unix':
 ../../src/client/store_in_cc.c:135: error: invalid operands to binary -

if I print the result of timezone(), I get:

 GMT+10:00

ie. a string rather than a number.

Is there a standard way to convert cygwin's 'timezone' to the number 
expected by the Linux code?

regards

King Lung Chiu


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019