[25992] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8211 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 28 18:05:31 2005

Date: Tue, 28 Jun 2005 15:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 28 Jun 2005     Volume: 10 Number: 8211

Today's topics:
        dealing with timestamped data collected in one zone and <Mark.Seger@hp.com>
    Re: dealing with timestamped data collected in one zone <glex_no-spam@qwest-spam-no.invalid>
    Re: dealing with timestamped data collected in one zone <No_4@dsl.pipex.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 28 Jun 2005 16:27:04 -0400
From: Mark Seger <Mark.Seger@hp.com>
Subject: dealing with timestamped data collected in one zone and reported in another
Message-Id: <42c1b299$1@usenet01.boi.hp.com>

I'm surprised I can't find what I'm trying to do in existing modules  or 
maybe I'm just not looking in the right places.  8-)

I'm creating some time based logs (recording the UTC as reported by 
gettimeofday()) in one timezone and I want to play them back in another, 
showing the times on the system where they were initially recorded.  In 
other words, if I record a file in stockholm which is GMT +2 and play it 
back in Boston which is GMT -4, data recorded at midnight in stockholm 
shows up 6 hours earlier because of the time difference.

The simple solution, and this is too simple as I'll get to in a minute, 
is to just record the timezone where the data was recorded.  That way 
when I go to play it back I can tell there is a 6 hour difference and 
simply adjust the times accordingly before calling localtime() to 
convert them.  This works like a champ, but...

Although many countries around the world support daylight savings time, 
they do not do it on the same date!  In other words, if I use my simple 
algorithm above it will break when one country has adjusted its clocks 
and the other hasn't.  The one simple solution I can think of that will 
make this all work is that if I were do know my offset from GMT not for 
the current date, but for the date of the data I wish to process.  But I 
can't seem to find any such function.

Can someone help?  Does someone have a better way to solve this problem?

-mark


------------------------------

Date: Tue, 28 Jun 2005 15:54:27 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: dealing with timestamped data collected in one zone and reported in another
Message-Id: <7Oiwe.81$xG2.1315@news.uswest.net>

Mark Seger wrote:
[...]
> Although many countries around the world support daylight savings time, 
> they do not do it on the same date!  In other words, if I use my simple 
> algorithm above it will break when one country has adjusted its clocks 
> and the other hasn't.  The one simple solution I can think of that will 
> make this all work is that if I were do know my offset from GMT not for 
> the current date, but for the date of the data I wish to process.  But I 
> can't seem to find any such function.
> 
> Can someone help?  Does someone have a better way to solve this problem?
> 
> -mark

For dealing with timezones, try the modules available under DateTime. 
See CPAN or http://datetime.perl.org/ for more information.


------------------------------

Date: Tue, 28 Jun 2005 22:07:07 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: dealing with timestamped data collected in one zone and reported in another
Message-Id: <A9CdncXVM4NmJlzfRVnyiA@pipex.net>

Mark Seger wrote:
> 
> Although many countries around the world support daylight savings time, 
> they do not do it on the same date!  In other words, if I use my simple 
> algorithm above it will break when one country has adjusted its clocks 
> and the other hasn't.

    This is OS dependent.  Most Unix systems (using Olson's time code) 
would handle this correctly.

> Can someone help?  Does someone have a better way to solve this problem?

    Which OS are you using?  Which OS is the final user going to be using?


-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8211
***************************************


home help back first fref pref prev next nref lref last post