Ok, I'm loss here:

    java.util.Calendar now = 
GregorianCalendar.getInstance(TimeZone.getTimeZone("America/Montreal"));
    NSTimestamp nst = new NSTimestamp(now.getTimeInMillis(), now.getTimeZone());
    NSLog.out.appendln(nst);
    NSLog.out.appendln(nst.getTime());
    NSLog.out.appendln(nst.timeZone().getID());

So, the time coming from java.util.Calendar is 19:16:19, in America/Montreal. 
That's ok. The problem is with NSTimestamp:

    mars 05 19:16:19 ShareCalPrototype[53879] INFO  NSLog  - 2011-03-05 
19:16:19 Etc/GMT  
    mars 05 19:16:19 ShareCalPrototype[53879] INFO  NSLog  - 1299352579671   
    mars 05 19:16:19 ShareCalPrototype[53879] INFO  NSLog  - Etc/GMT

So the time is 19:16:19 in the NSTimestamp, but the timezone is GMT, so when I 
display it in America/Montreal, it shows 14:16:19 :-/

According to the JavaDoc:

  NSTimestamp does not maintain time zone information. All NSTimestamps are 
millisecond offsets since the reference date in the reference time zone. This 
method assumes time is a time from the tz time zone, and converts time into a 
time appropriate for NSTimestamp to handle.

Ok, so I guess it's normal that the timezone is GMT, but it should add 5 hours 
to the time? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to