From eeec1a172ce5a85e8f95b372b53bb3449e5219f5 Mon Sep 17 00:00:00 2001 From: cgf Date: Thu, 28 Mar 2002 04:56:06 +0000 Subject: [PATCH] * times.cc (gettimeofday): Revert to setting timezone info if tz != NULL. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/times.cc | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d880a71abc..9d5bc78414 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-03-27 Wu Yongwei + + * times.cc (gettimeofday): Revert to setting timezone info if tz != + NULL. + 2002-03-21 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index b7308bf020..1ad6764536 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -155,12 +155,24 @@ extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz) { static hires gtod; + static tzflag; LONGLONG now = gtod.usecs (false); if (now == (LONGLONG) -1) return -1; tv->tv_sec = now / 1000000; tv->tv_usec = now % 1000000; + + if (tz != NULL) + { + if (!tzflag) { + tzset(); + tzflag = 1; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + return 0; } -- 2.11.0