jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: Calendar.getInstance() usage
Date Fri, 06 Sep 2013 15:06:46 GMT
Hi,

On Fri, Sep 6, 2013 at 10:45 AM, Michael Dürig <mduerig@apache.org> wrote:
> I think it should be
>
> return PropertyStates.createProperty(name, Calendar.getInstance());
>
> in TreeUtil. This should properly deal with the time zone. Using
> System.currentMillis you need to take care of the JCR value conversions from
> long to Calendar manually.

PropertyStates keep dates internally as long timestamps, so we don't
need any value conversions if we just do:

    return PropertyStates.createProperty(name,
System.currentTimeMillis(), DATE);

Value conversions are needed when the value is read as a date by a JCR
client. Only at that point does the time zone stuff kick in.

BR,

Jukka Zitting

Mime
View raw message