Ok, I am getting the problem again. I am not really sure how to
determine WHEN it will happen, but it seems to come and go.
The XML received over the socket:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tm:taskman
xsi:schemaLocation="
http://www.temporal-wave.com/spec/taskman
taskman.xsd" xmlns:tm="
http://www.temporal-wav
e.com/spec/taskman"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<tm:new name="hello" priority="10" active="true">
<tm:action>
<tm:exec cmd="hello">
<tm:cwd>e:\jbase4home</tm:cwd>
<tm:env value="e:\jbase4home" name="HOME"/>
</tm:exec>
</tm:action>
<tm:schedule>
<tm:start>2003-08-27T12:09:00.695-08:00</tm:start>
</tm:schedule>
<tm:description>Run hello.b</tm:description>
</tm:new>
</tm:taskman>
The scheduling code:
public void schedule(NewTask task)
{
ScheduleInfo schedule = task.getSchedule();
Calendar start = schedule.getStart();
// temp bug workaround for testing
//start.set(Calendar.HOUR, start.get(Calendar.HOUR)-1);
schedule(task.getName(), start.getTime());
}
public void schedule(String taskName, Date start)
{
TimedTask task = new TimedTask(this, taskName);
scheduler.schedule(task, start);
System.out.println("Scheduled " + taskName + " to start
at " + start);
}
The result of that System.out:
Scheduled hello to start at Wed Aug 27 13:09:00 PDT 2003
The client and server are the same machine, thus they are the same
timezone. The XML file was created with the correct timestamp, but the
Calendar instance returned from the autogenerated files have the wrong
time. The code has not been changed. The only thing I can think of is
that it usually seems to fail at 12:xx PM.
Malachi
-----Original Message-----
From: Malachi de Aelfweald
Sent: Tuesday, August 26, 2003 9:51 AM
To: users_at_jaxb.dev.java.net
Well, Date.getHours() is deprecated. If you create a new Calendar from
the Date instance, it is still correct...
import java.util.*;
public class timeTest
{
public static void main(String[] args)
{
Calendar time = Calendar.getInstance();
System.out.println("HOURS: " + time.get(Calendar.HOUR));
Date d = time.getTime();
System.out.println("DATE: " + d);
time.setTime(d);
System.out.println("HOURS: " + time.get(Calendar.HOUR));
/**
* Results
HOURS: 9
DATE: Tue Aug 26 09:49:59 PDT 2003
HOURS: 9
*/
}
}
-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Tuesday, August 26, 2003 9:32 AM
To: users_at_jaxb.dev.java.net
Wait, is this really a problem of JAXB or is this a problem of
java.util.Date?
I run a similar code. When I did:
Calendar start = schedule.getStart();
print( start.get(Calendar.HOUR_OF_DAY) );
I correctly get 13, but when I did:
Calendar start = schedule.getStart();
Date time = start.getTime();
print( time.getHours() );
I got 14. Note that when I change the time instant to
1999-05-31T12:34:56.052+09:00, those two values are wildly different (12
and 20)
regards,
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net