Today's gem from my O'Reilly Oracle books is that Oracle9i introduced TIMESTAMP and INTERVAL datatypes to provide more functionality than DATE alone could. It's always bothered me that arithmetic among DATEs gave you simple numbers, and that those numbers represented days and not something more granular.
Way back in 2000, after catching our few Y2K bugs that slipped past our audit, I began designing a Perl module to replace all of our date computations. I completely mapped out the API on my whiteboard in red marker, where it stayed for about six months. Drawing on experience with dBase IV of all things, I knew I needed an opaque object that represented a date. I named it Time::Stamp. I inferred for myself (I think; I don't recall having seen this anywhere else) that arithmetic among Time::Stamp objects would also require a Time::Interval class. Note anything interesting about that naming convention, compared to what Oracle did?
Of course, I never got time to implement much of my API, and then along came Matt Sergeant who invented Time::Object, later Time::Piece. Time::Object and Time::Seconds were almost exactly what I'd conceived of. Some method names were different, and there were some features I hadn't thought of, and a couple missing, but it wasn't vaporware! And the rest is history.
Nowadays I see exciting things ahead in the Perl datetime list. I notice the latest beta release of Time::Piece is reimplemented in terms of the new universal Perl time class.
Incidentally, I'm out of the group where I introduced the use of Time::Piece, but I did get to implement Time::Stamp. It's a subclass of Time::Piece (which wasn't easy to subclass for various reasons) with added convenience methods of yymmdd, yymmddhh, yymmddhhmm, etc. I think the new universal datetime classes are going to handle that.
Re:ymd?
jdavidb on 2003-02-13T14:12:59
There was something wrong with it; can't remember what. Where "wrong" means "wasn't exactly what we needed." I also needed a constructor from YYMMDD[HH[MM]] timestamps when there was no strptime.
Are you absolutely certain ymd was always there, from the beginning in Time::Object?
Hmmm
... does some searching ... Ah! Oh, yes: ymd gave YYYY/MM/DD in those days, and I really needed no slashes and (for backward compatibility) two digit years. Hmm, still does, but with hyphens now (customizable, presumably with "").
It wasn't a fatal flaw, and it gave me a much needed exercise in subclassing.
:) Re:ymd?
jdavidb on 2003-02-13T14:13:49
BTW, I actually named my methods
yymmdd
,yymmddhh
, etc. I always wanted to go back and doyyyymmdd
, etc.