Timestamps

“Tobias” == Tobias Brox tobix@tobiasb.funcom.com writes:

Tobias> How do we deal with the timestamps from the DB?  I think it would make
Tobias> sense to abstract it to DBIx::Record to parse the timestamps from the
Tobias> DB and return timestamps as objects with different access methods.  I
Tobias> think it would be nice using constructs like
Tobias> $self->Created->localtime, $self->Created->time,
Tobias> $self->Created->strftime(..) etc.

Tobias> There are two reasons for keeping them down at the DBIx::Record level;
Tobias> the output from the DB might be DBMS-specific (I've seen other DBMS'es
Tobias> printing it in ISO-format (readable) while Mysql prints it without any
Tobias> delimiters).  The other reason is that parsing dates from a DB really
Tobias> isn't RT-specific.

Tobias> There is a myriad of packages at CPAN related to date and time parsing
Tobias> - but AFAIK most of them are function oriented, not object oriented
Tobias> (and I've even experienced that some of them are incompatible due to
Tobias> namespace conflicts).  Does anybody know of an object oriented package
Tobias> which can be used?  

I don’t know if that’s what you’re looking for, but take a look at
OO-DateTime (author: TOBIX, current: OO-DateTime-0.01.tar.gz).

Hugues Lafarge || Email: Hugues.Lafarge@afp.com
Agence France Presse || WWW: http://www.multimania.com/hlafarge
Ingenierie informatique || Phone: +33 1 40 41 77 15
4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24

“Hugues” == Hugues Lafarge Hugues.Lafarge@afp.com writes:

“Tobias” == Tobias Brox tobix@tobiasb.funcom.com writes:
Tobias> How do we deal with the timestamps from the DB? I think it would make
Tobias> sense to abstract it to DBIx::Record to parse the timestamps from the
Tobias> DB and return timestamps as objects with different access methods. I
Tobias> think it would be nice using constructs like
Tobias> $self->Created->localtime, $self->Created->time,
Tobias> $self->Created->strftime(…) etc.

Tobias> There are two reasons for keeping them down at the DBIx::Record level;
Tobias> the output from the DB might be DBMS-specific (I've seen other DBMS'es
Tobias> printing it in ISO-format (readable) while Mysql prints it without any
Tobias> delimiters).  The other reason is that parsing dates from a DB really
Tobias> isn't RT-specific.

Tobias> There is a myriad of packages at CPAN related to date and time parsing
Tobias> - but AFAIK most of them are function oriented, not object oriented
Tobias> (and I've even experienced that some of them are incompatible due to
Tobias> namespace conflicts).  Does anybody know of an object oriented package
Tobias> which can be used?  

Hugues> I don't know if that's what you're looking for, but take a look at
Hugues> OO-DateTime (author: TOBIX, current: OO-DateTime-0.01.tar.gz).

Oops, after taking a closer look, i realize that this is not a real
module, but just a container to expose what plans the author has in
mind.

Sorry for that.
Might be interesting anyway …

Hugues Lafarge || Email: Hugues.Lafarge@afp.com
Agence France Presse || WWW: http://www.multimania.com/hlafarge
Ingenierie informatique || Phone: +33 1 40 41 77 15
4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24

I don’t know if that’s what you’re looking for, but take a look at
OO-DateTime (author: TOBIX, current: OO-DateTime-0.01.tar.gz).

:)))

I eventually grew tired looking for it, so I had to start at it myself.

Tobias Brox (alias TobiX) - +4722925871 - urgent emails to
sms@tobiasb.funcom.com. Check our upcoming MMORPG at
http://www.anarchy-online.com/ (Qt) and play multiplayer Spades,
Backgammon, Poker etc for free at http://www.funcom.com/ (Java)