On 07/31/2012 10:49 AM, Tomas Lestach wrote:
> Hello Johannes,
> 
> I'd rather like a package build times only patch. Your current patch causes 
> issues within the taskomatic as the dates are expected in the local timezone 
> of the DB machine. I'm not sure about other issues.

Ok, so here is a patch proposal to fix the package build times only.
I don't really like this one, but it works. The Date objects in Java
is really a PITA to work with.

Regards,
Johannes

-- 
SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg)
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
>From 57cc8bee7b5d77486671cff244551d12a95cdcb2 Mon Sep 17 00:00:00 2001
From: Johannes Renner <jren...@suse.de>
Date: Tue, 31 Jul 2012 16:03:40 +0200
Subject: [PATCH] Fix wrong package build times in repository metadata

---
 .../com/redhat/rhn/frontend/dto/PackageDto.java    |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
index 7e39d26..0d7995c 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
@@ -14,12 +14,16 @@
  */
 package com.redhat.rhn.frontend.dto;
 
+import com.redhat.rhn.common.RhnRuntimeException;
 import com.redhat.rhn.common.hibernate.HibernateFactory;
 import com.redhat.rhn.common.util.CompressionUtil;
 import com.redhat.rhn.frontend.xmlrpc.packages.PackageHelper;
 
 import java.sql.Blob;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.TimeZone;
 /**
  * PackageDto
  * @version $Rev$
@@ -265,7 +269,13 @@ public class PackageDto extends BaseDto {
      * @param buildTimeIn The buildTime to set.
      */
     public void setBuildTime(Date buildTimeIn) {
-        this.buildTime = buildTimeIn;
+        SimpleDateFormat dateFormatGMT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
+        dateFormatGMT.setTimeZone(TimeZone.getTimeZone("GMT"));
+        try {
+            this.buildTime = dateFormatGMT.parse(buildTimeIn.toString());
+        } catch (ParseException e) {
+            throw new RhnRuntimeException(e);
+        }
     }
 
     /**
-- 
1.7.7

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to