aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/times.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-03-28 04:56:06 +0000
committerChristopher Faylor <me@cgf.cx>2002-03-28 04:56:06 +0000
commit7d7524e57db3db1010c7896a5f4a88e95c4015d3 (patch)
treea4ac1f40e688213fd69aa260f26aef76d1632c2c /winsup/cygwin/times.cc
parentc82479b1e3b16e34f4033d4ea367ecd8d694fe25 (diff)
downloadnewlib-7d7524e57db3db1010c7896a5f4a88e95c4015d3.zip
newlib-7d7524e57db3db1010c7896a5f4a88e95c4015d3.tar.gz
newlib-7d7524e57db3db1010c7896a5f4a88e95c4015d3.tar.bz2
* times.cc (gettimeofday): Revert to setting timezone info if tz != NULL.
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r--winsup/cygwin/times.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index b7308bf..1ad6764 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;
}