delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/05/11:54:40

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
X-Server-Uuid: 0A4F2A26-D23B-4C5A-98BA-1B421465C24E
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: perl 5.8.2's localtime reports gmtime
Date: Fri, 5 Mar 2004 10:53:12 -0600
Message-ID: <F67AB1DD14544242BE5BFE94F5939175B7F353@E2KMEMMCS1.ftbco.ftn.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "DePriest, Jason R." <jrdepriest AT ftb DOT com>
To: "The Cygwin Mailing List" <cygwin AT cygwin DOT com>
X-OriginalArrivalTime: 05 Mar 2004 16:53:13.0106 (UTC) FILETIME=[58E5CF20:01C402D2]
X-WSS-ID: 6C566FF32PC3620915-01-01
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i25GsbkW014158

> -----Original Message-----
> From: cygwin-owner at cygwin dot com 
> [mailto: cygwin-owner at cygwin dot com] On Behalf Of Keith Bainbridge

> Sent: Thursday, March 04, 2004 6:35 PM
> To: The Cygwin Mailing List
> Subject: Re: perl 5.8.2's localtime reports gmtime
> 
> 
> Steve Kelem wrote:
> 
> > I'm running the latest cygwin, including perl 5.8.2:
> > % perl -version
> >
> > This is perl, v5.8.2 built for cygwin-thread-multi-64int
> 
> Ug.  Read the archives.  This has come up several times in the last
> couple of weeks, it's a known bug that will be fixed in the 
> next Cygwin
> DLL release.  See for example
> <http://marc.theaimsgroup.com/?l=cygwin&m=107668514008908>.  Your
> options are: Try a recent snapshot, use Perl <= 5.8.0, or wait for
> Cygwin 1.5.8.
> 
> Brian
> 
>

I actually implemented the following so that my script will still work
correctly after whatever whatever is fixed.

I am in the Central Time Zone, so you'd have to adjust the number of
seconds you add or remove accordingly.

[code]
use Time::Local;
print "GM: " . gmtime() . "\n";
print "Local: " . localtime() . "\n";
if (gmtime() eq localtime()) {
	print "GM time and localtime are the same!\n";
	print "I'll have to make some adjustments.\n";
	if ($isdst) {
		$time = time() - 18000;
	} # end of if it is daylight savings time
	else {
		$time = time() - 21600;
	} # end of else it is standard time
	$adjtime = gmtime($time);
	print "Adjusted: $adjtime\n";
	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
gmtime($time);
	$mon += 1;
	$year += 1900;
} # end of if local time is calculated as gm time
else {	
	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime;
	$mon += 1;
	$year += 1900;
} # end of else the local time is correct
[/code]

-Jason


--
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