Re: [DocumentNodeStore] Clarify behaviour for Commit.getModified

2014-03-28 Thread Chetan Mehrotra
> I think the intention of the method is to return a value in
seconds with a five second resolution.

Makes sense. Change the logic to use seconds and also fixed method
names/constant to reflect that
Chetan Mehrotra


On Fri, Mar 28, 2014 at 3:28 PM, Marcel Reutegger  wrote:
> Hi,
>
> the fix looks good, but why do you want to convert the
> seconds to milliseconds again at the end?
>
> I think the intention of the method is to return a value in
> seconds with a five second resolution.
>
> we definitively need to add javadoc :-/
>
> Regards
>  Marcel
>
>> -Original Message-
>> From: Chetan Mehrotra [mailto:chetan.mehro...@gmail.com]
>> Sent: Donnerstag, 27. März 2014 18:05
>> To: oak-dev@jackrabbit.apache.org
>> Subject: [DocumentNodeStore] Clarify behaviour for Commit.getModified
>>
>> Hi,
>>
>> Currently Commit.getModified has following impl
>>
>> -
>> public static long getModified(long timestamp) {
>> // 5 second resolution
>> return timestamp / 1000 / 5;
>>  }
>> -
>>
>> The result when treated as timestamp cause the time to set to 0 i.e. 1970
>>
>> I intend to fix this with (looking at comment)
>>
>> -
>> public static long getModified(long timestamp) {
>> long timeInSec = TimeUnit.MILLISECONDS.toSeconds(timestamp);
>> timeInSec = timeInSec - timeInSec % 5;
>> return TimeUnit.SECONDS.toMillis(timeInSec);
>> }
>> -
>>
>> Would that be correct approach?
>>
>> Chetan Mehrotrarted


RE: [DocumentNodeStore] Clarify behaviour for Commit.getModified

2014-03-28 Thread Marcel Reutegger
Hi,

the fix looks good, but why do you want to convert the
seconds to milliseconds again at the end?

I think the intention of the method is to return a value in
seconds with a five second resolution.

we definitively need to add javadoc :-/

Regards
 Marcel

> -Original Message-
> From: Chetan Mehrotra [mailto:chetan.mehro...@gmail.com]
> Sent: Donnerstag, 27. März 2014 18:05
> To: oak-dev@jackrabbit.apache.org
> Subject: [DocumentNodeStore] Clarify behaviour for Commit.getModified
> 
> Hi,
> 
> Currently Commit.getModified has following impl
> 
> -
> public static long getModified(long timestamp) {
> // 5 second resolution
> return timestamp / 1000 / 5;
>  }
> -
> 
> The result when treated as timestamp cause the time to set to 0 i.e. 1970
> 
> I intend to fix this with (looking at comment)
> 
> -
> public static long getModified(long timestamp) {
> long timeInSec = TimeUnit.MILLISECONDS.toSeconds(timestamp);
> timeInSec = timeInSec - timeInSec % 5;
> return TimeUnit.SECONDS.toMillis(timeInSec);
> }
> -
> 
> Would that be correct approach?
> 
> Chetan Mehrotrarted