SLUG Mailing List Archives
Re: [SLUG] Best API/abstraction? [Was: Time Pedantry] servers?)
- To: Del <del@xxxxxxxxxxxx>
- Subject: Re: [SLUG] Best API/abstraction? [Was: Time Pedantry] servers?)
- From: Adrian Chadd <adrian@xxxxxxxxxxxxxxx>
- Date: Thu, 8 Apr 2010 09:32:55 +0800
- Cc: slug@xxxxxxxxxxx
- User-agent: Mutt/1.5.13 (2006-08-11)
On Thu, Apr 08, 2010, Del wrote:
> >So which language / library has a great abstraction for time and date
> >helping you deal with the intricacies of this craziness?
> Zend Framework (PHP) -- Zend_Date. The date handling functions in PHP are
> pretty limited but this extension library of an extension library works
> Whatever library the Remember The Milk (www.rememberthemilk.com) folks use
> is pretty good. I can type in "second friday after the third tuesday in
> november at 4pm" and it gets that, and sends me the reminder notice at the
> correct time even if I tell it I've changed my time zone to "Chatham
> Islands Daylight Savings Time" in the mean while. It also understands that
> "repeat every three weeks" means 21 days after the event was first
> scheduled but "repeat after three weeks" means 21 days after I actually got
> around to doing it (after postponing it several times).
Right, but that's just for parsing dates. But does your code, which uses
timestamps for calculation, get "one day later" correct when DST changeovers
occur? When leap seconds occur?
Most users/developers only see date parsing and storage as the only issues.
There's also date manipulation (eg "now plus a day"), date comparison, etc.
Most developers never have to care about things such as the occasional
leap seconds. But this means "next day" does not necessarily mean "current
unix timestamp + 86400 seconds" and some environments I've been in matter.
(Say you're billing thousands of dollars every -second- per client
and your clients are happy to sue if you fuck up...)