[Rt-commit] r18569 - in rt/3.999/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Feb 24 20:59:46 EST 2009


Author: sartak
Date: Tue Feb 24 20:59:46 2009
New Revision: 18569

Modified:
   rt/3.999/trunk/   (props changed)
   rt/3.999/trunk/lib/RT/DateTime.pm

Log:
 r80531 at onn:  sartak | 2009-02-24 20:59:40 -0500
 Add an RT::DateTime->age method to return the duration from then til now (or some other time)


Modified: rt/3.999/trunk/lib/RT/DateTime.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/DateTime.pm	(original)
+++ rt/3.999/trunk/lib/RT/DateTime.pm	Tue Feb 24 20:59:46 2009
@@ -4,5 +4,12 @@
 package RT::DateTime;
 use base 'Jifty::DateTime';
 
+sub age {
+    my $self  = shift;
+    my $until = shift || RT::DateTime->now;
+
+    return $until - $self;
+}
+
 1;
 


More information about the Rt-commit mailing list