RE: Daylight Savings Time?
On Thu, 26 Jan 2012, Barry Brevik wrote: > > In list context it returns the DST state as the last value so > > (localtime())[-1] would give that value. > > OK, that is just lame of me to miss that. Thank you so much. > Not sure if this matters to you, but at least older versions of Windows > (before Vista) did not store historical DST information (the "Olson" database). I am fine with that. Barry Brevik ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Daylight Savings Time?
On Thu, 26 Jan 2012, Barry Brevik wrote: > > In list context it returns the DST state as the last value so > > (localtime())[-1] would give that value. > > OK, that is just lame of me to miss that. Thank you so much. Not sure if this matters to you, but at least older versions of Windows (before Vista) did not store historical DST information (the "Olson" database). Instead it would apply the latest set of DST rules to all previous years as well, so the DST state for dates in the past may be incorrect. But even though historical data is now available in the OS, I would still double check if the C runtime library used by Perl makes use of it or not. Cheers, -Jan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Daylight Savings Time?
> In list context it returns the DST state as the last > value so (localtime())[-1] would give that value. OK, that is just lame of me to miss that. Thank you so much. Barry Brevik ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Daylight Savings Time?
On Thu, Jan 26, 2012 at 10:27 PM, Barry Brevik wrote: > I'm on Windows Perl 5.8.8 and I'm writing an app that needs to deal with > daylight savings time. The date is an RFC 822 formatted date which looks > like this "Wed, 03 Sep 2008 08:58:27 -0800", and what I'm looking for is > the "-0800" part which changes based on the daylight savings time state. > > I want something light weight (rather not use a module) and it only has > to deal with the PST timezone. > > Has anyone found a Win32:: method that will retrieve the DST state from > Windows? Also, when the date is expressed in that format, is it supposed > to represent UTC time along with the offset? > > Barry Brevik While I think I'd stromgly recommend using the DateTime modules for anything except the most basic time handling you could use localtime(). In list context it returns the DST state as the last value so (localtime())[-1] would give that value. AFAIK that works on Windows as well. regards Gabor -- Gabor Szabo http://szabgab.com/ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Daylight Savings Time?
I'm on Windows Perl 5.8.8 and I'm writing an app that needs to deal with daylight savings time. The date is an RFC 822 formatted date which looks like this "Wed, 03 Sep 2008 08:58:27 -0800", and what I'm looking for is the "-0800" part which changes based on the daylight savings time state. I want something light weight (rather not use a module) and it only has to deal with the PST timezone. Has anyone found a Win32:: method that will retrieve the DST state from Windows? Also, when the date is expressed in that format, is it supposed to represent UTC time along with the offset? Barry Brevik ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Daylight Savings Time
> -Original Message- > From: David Dick [mailto:[EMAIL PROTECTED] > Sent: Monday, October 31, 2005 14:57 > To: Dirk Bremer > Cc: perl-win32-users@listserv.ActiveState.com > Subject: Re: Daylight Savings Time > > Dirk Bremer wrote: > > I check certain files' modification dates against a > modification date > > stored in a database for the corresponding file. The files were not > > modified since they were entered into the database, i.e. the dates > > should have been equal. At about 01:00 on 10-30-2005, > things were a bit > > different. For example, the date stored in the database was > 2005-10-17 > > 14:28:10, while after the time changed, the date returned > was 2005-10-17 > > 13:28:10, an exact one-hour difference. The modification date was > > obtained from stat. This did cause some problems. > > i'm guessing you're storing dates in localtime? is it > possible for you > to store the dates in gmtime and display in localtime? > > uru > -Dave > Dave & $Bill, Yes, it looks like using epoch-time is the way to go. I'll need to add a new column to the database table and then modify a few programs so I can store and compare the modification date as an epoch-time interval. Thanks for the suggestion. Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO - USA Central Time Zone 636-755-2652 fax 636-755-2503 [EMAIL PROTECTED] www.nisc.coop ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Daylight Savings Time
Dirk Bremer wrote: I check certain files' modification dates against a modification date stored in a database for the corresponding file. The files were not modified since they were entered into the database, i.e. the dates should have been equal. At about 01:00 on 10-30-2005, things were a bit different. For example, the date stored in the database was 2005-10-17 14:28:10, while after the time changed, the date returned was 2005-10-17 13:28:10, an exact one-hour difference. The modification date was obtained from stat. This did cause some problems. i'm guessing you're storing dates in localtime? is it possible for you to store the dates in gmtime and display in localtime? uru -Dave ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Daylight Savings Time
Dirk Bremer wrote: > What, nobody else had a daylight savings time change issue? Well, I sure > did. > > I check certain files' modification dates against a modification date > stored in a database for the corresponding file. The files were not > modified since they were entered into the database, i.e. the dates > should have been equal. At about 01:00 on 10-30-2005, things were a bit > different. For example, the date stored in the database was 2005-10-17 > 14:28:10, while after the time changed, the date returned was 2005-10-17 > 13:28:10, an exact one-hour difference. The modification date was > obtained from stat. This did cause some problems. If you store epoch time, there shouldn't be an issue. How are you storing your dates ? And how are you retrieving them back for display ? > I guess that ideally, the program which performs these comparisons would > be aware of when the time changes twice a year to and from daylight > savings time and would adjust the returned modification dates. The issue > is how to identify within a Perl program the time changes. Note that > this action is occurring on Windows-based servers and if I examine the > file in the above example's modification date using Windows Explorer, it > is reported as 2005-10-17 13:28:10. Not necessary if you use epoch time. > To compound this, I have heard that the time-change schedule would be > changed in 2006 so that DST would start 2-weeks earlier and end 1-week > later. > > Is there a way to determine DST changes in Perl through a module, etc.? > Or would one have to manually account for the DST schedule every year? localtime should handle it if you start with epoch time. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Daylight Savings Time
What, nobody else had a daylight savings time change issue? Well, I sure did. I check certain files' modification dates against a modification date stored in a database for the corresponding file. The files were not modified since they were entered into the database, i.e. the dates should have been equal. At about 01:00 on 10-30-2005, things were a bit different. For example, the date stored in the database was 2005-10-17 14:28:10, while after the time changed, the date returned was 2005-10-17 13:28:10, an exact one-hour difference. The modification date was obtained from stat. This did cause some problems. I guess that ideally, the program which performs these comparisons would be aware of when the time changes twice a year to and from daylight savings time and would adjust the returned modification dates. The issue is how to identify within a Perl program the time changes. Note that this action is occurring on Windows-based servers and if I examine the file in the above example's modification date using Windows Explorer, it is reported as 2005-10-17 13:28:10. To compound this, I have heard that the time-change schedule would be changed in 2006 so that DST would start 2-weeks earlier and end 1-week later. Is there a way to determine DST changes in Perl through a module, etc.? Or would one have to manually account for the DST schedule every year? Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO - USA Central Time Zone 636-755-2652 fax 636-755-2503 [EMAIL PROTECTED] www.nisc.coop ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs