[Rt-commit] r18870 - rt/3.999/branches/datetime/sbin

sartak at bestpractical.com sartak at bestpractical.com
Thu Mar 19 17:24:51 EDT 2009


Author: sartak
Date: Thu Mar 19 17:24:51 2009
New Revision: 18870

Modified:
   rt/3.999/branches/datetime/sbin/rt-email-digest

Log:
Use RT::DateTime in rt-email-digest

Modified: rt/3.999/branches/datetime/sbin/rt-email-digest
==============================================================================
--- rt/3.999/branches/datetime/sbin/rt-email-digest	(original)
+++ rt/3.999/branches/datetime/sbin/rt-email-digest	Thu Mar 19 17:24:51 2009
@@ -200,17 +200,16 @@
 
     # Specify a short time for digest overlap, in case we aren't starting
     # this process exactly on time.
-    my $OVERLAP_HEDGE = -30;
+    my $OVERLAP_HEDGE = 30;
 
-    my $since_date = RT::Date->new( current_user => RT->system_user );
-    $since_date->set( format => 'unix', value => time() );
+    my $since_date = RT::DateTime->now;
     if ( $frequency eq 'daily' ) {
-        $since_date->add_days(-1);
+        $since_date->subtract(days => 1);
     } else {
-        $since_date->add_days(-7);
+        $since_date->subtract(days => 7);
     }
 
-    $since_date->add_seconds($OVERLAP_HEDGE);
+    $since_date->subtract(seconds => $OVERLAP_HEDGE);
 
     return $since_date;
 }
@@ -296,13 +295,7 @@
                 unless ($date) {
                     my $txn_obj = RT::Model::Transaction->new( current_user => RT->system_user );
                     $txn_obj->load($txn);
-                    my $date_obj = RT::Date->new( current_user => RT->system_user );
-                    $date_obj->set(
-                        format => 'sql',
-                        value  => $txn_obj->created
-                    );
-                    $date = strftime( '%a, %d %b %Y %H:%M:%S %z',
-                        @{ [ localtime( $date_obj->unix ) ] } );
+                    $date = RT::DateTime->new_from_string($txn_obj->created)->rfc2822;
                 }
                 $contents_body .= "Date: $date\n\n";
                 $contents_body .= $msg->content . "\n";


More information about the Rt-commit mailing list