Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: RFC 822 date manipulation without DateTime module?

by GhodMode (Pilgrim)
on Jun 12, 2009 at 12:29 UTC ( [id://770933]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC 822 date manipulation without DateTime module?
in thread RFC 822 date manipulation without DateTime module?

I can't use gmtime because it can't use a string like the date specification in an RSS feed. It only takes the number of seconds since the epoch as returned by time (or the shell's date +%s).

The only real problem is with the text representation of the time-zone. Looking through the time zones used in my feeds, I see that they're using either an offset of UTC, or a three-character representation of the time zone. These are mentioned in RFC 822, but it also says that "time zone may be indicated in several ways".

The notes for the POSIX strftime function say that the timezone format specifier is notoriously unportable because the timezones are non-standard. That's probably a good reason why it's not built into the core of the language. The (GNU/Linux) shell's date program recognizes every one, though, whether it uses the offset or the abbreviation.

--
-- Ghodmode
Blessed is he who has found his work; let him ask no other blessedness.
-- Thomas Carlyle
  • Comment on Re^2: RFC 822 date manipulation without DateTime module?

Replies are listed 'Best First'.
Re^3: RFC 822 date manipulation without DateTime module?
by Marshall (Canon) on Jun 12, 2009 at 13:38 UTC
    I was just saying the time conversion routines will take a trip through epoch time. That is true for whatever module or library that you use. These things take your text and convert it to a number and then take that number and make new text out of it!

    I found this article on Tech Republic: http://articles.techrepublic.com.com/5100-10878_11-6132371.html

    Basically this local time to gmtime is a mess! I hear that there are some parts of US states that adjust clocks +-30 minutes, not whole hours! The Perl modules will do what the GNU modules will do and maybe even more.

    If you are really interested in "getting it right", I would suggest the Perl date/time module. This thing figures out leap seconds and stuff like that.

    for conversion like from PDT to PSDT, etc, Perl is great at that!

      You're right, of course. Date::Time is the right way to do it.

      I'm just trying to minimize external dependencies. It's a hassle to install Perl dependencies. I need root access to use the cpan module or install something using APT. I don't even want to consider how Windows folks would do it.

      I would also need to eliminate the dependence on XML::LibXML (without replacing it with something else external). So, this is probably a wasted effort for me. I'm learning and having fun though :)

      After I'm done with this program, I might try with another language. Perl is still my favorite, but portability and easy installation (or no installation) are my goals. Besides that, I think I have some ideas about how a podcast downloader/client should be that are unique enough to eventually turn this into an open-source project.

      --
      -- Ghodmode
      
      Blessed is he who has found his work; let him ask no other blessedness.
      -- Thomas Carlyle

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://770933]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found