develooper Front page | perl.perl5.porters | Postings from October 1999

Suggestion for TIME API extention

Thread Next
Todd C. Olson
October 29, 1999 08:50
Suggestion for TIME API extention
Message ID:

It appears that there is no easy way to obtain the *numeric* offset between
localtime and gmtime.

This info is desirable for composing dates for email messages

       Mon, 25 Oct 1999 18:58:34 -0400
       Mon, 25 Oct 1999 18:58:20 -0400 (EDT)

with strftime the best you can do is:

       Mon, 25 Oct 1999 18:58:20 (EDT)

strftime can not generate the "-0400"

Yes it is possible to write a routine (as Larry Rosler has) that
computes this offset from the localtime and the gmtime
BUT it seems like such a waste of cycles, especially since the
information has to be in there some where to compute the localtime
in the firstplace.

Part of the problem is that POSIX seems to provide no easy way to
get at this information.

As a solution, I would advocate adding another %token to strftime
that provides this information.

Why do I worry about cycles?  I'd like to write a perl script
that is invoked by sendmail and forwards the mail
(with appropriately added Received line (with date))
to the appropriate component of a multihost e-mail-list server
implementation here at Cornell University.  The current scheme
seems sluggish ... and an unnecessary waste of cycles.

I might also suggest adding %tokens that return dates
formated according to the RFCs for email, news and widely used
protocols, to reduce badness in these areas.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About