Set timezone only for formating (Date object always in UTC).
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 6 Apr 2010 18:14:40 +0000 (18:14 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 6 Apr 2010 18:14:40 +0000 (18:14 +0000)
org.glite.lb.client-java/src/org/glite/lb/Context.java

index ca17855..76f4491 100644 (file)
@@ -20,8 +20,9 @@ package org.glite.lb;
 import java.text.SimpleDateFormat;
 
 import java.net.UnknownHostException;
-import java.util.Calendar;
+import java.util.Date;
 import java.util.Random;
+import java.util.SimpleTimeZone;
 import org.glite.jobid.Jobid;
 
 /**
@@ -177,10 +178,9 @@ public abstract class Context {
             srcInstance = new String("");
         }
 
-       Calendar cal = Calendar.getInstance();
-       cal.set(Calendar.ZONE_OFFSET,0);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
-       String date = df.format(cal.getTime()) + "000";
+       df.setTimeZone(new SimpleTimeZone(0, "UTC"));
+       String date = df.format(new Date()) + "000";
        
         if (seqCode != null) seqCode.incrementSeqCode(source);