delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/08/14/03:13:31

From: torger AT ludd DOT luth DOT se (Anders Torger)
Subject: B19: Newlib: mktime bug; it assumes GMT struct tm
14 Aug 1998 03:13:31 -0700 :
Message-ID: <2.2.32.19980813193710.00eeb9ac.cygnus.gnu-win32@zed.ludd.luth.se>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

The current implementation (B19) of mktime (time.h) incorrectly assumes that
the given argument of the type "struct *tm" represents GMT, and not local
time as it is supposed to do. It also ignores the field tm_isdst.

The current implementation is found in src/newlib/libc/time/mktime.c

The bug was reported a year ago in the following message:
http://www.cygnus.com/ml/gnu-win32/1997-Jul/0153.html 

Solving the first problem is very simple

change the (last) line
------------------------------
  return tim;
------------------------------
to
------------------------------
  tzset();
  return tim + _timezone;
------------------------------
in mktime.c

The second problem, that it ignores tm_isdst, may not be a problem. I've
seen other implementations ignoring the field, so I don't care providing a
fix for it. Which DST specification to follow is a problem anyway.

/Anders Torger

"Who can do anything after Beethoven?" -- Franz Schubert

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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