I did not mean to have this in Joda, I can write something that does it,
just wanted to know if my logic where if its not "iTimeField" (bigger
rounding), then:
long localInstant = iZone.convertUTCToLocal(instant);
localInstant = iField.roundCeiling(localInstant);
<-- here, localInstance is actually UTC millis, so we can use that as UTC
millis and not call the following:
return iZone.convertLocalToUTC(localInstant, false, instant);
When it is iTimeField, then the double conversion will keep it in UTC
millis.
On Fri, Dec 30, 2011 at 3:02 PM, Stephen Colebourne <scolebou...@joda.org>
wrote:
> I suspect that your use case is a little specific for Joda-Time, but
> hopefully the convertUTCToLocal() and similar methods will help you
> write the custom code.
>
> The iTimeField code below is an optimisation. If the field is smaller
> than a day, then there is no need to take time-zones into account in
> the same way. (Rounding to the nearest minute is only ever a small
> change)
>
> Stephen
>
>
> On 30 December 2011 12:52, Shay Banon <kim...@gmail.com> wrote:
> > First, thanks for sticking with me :). I think I might need to go down
> the
> > custom code route, wanted to verify if my logic is sound. Rounding based
> on
> > zone is done in ZoneChrono, basically, this:
> >
> > if (iTimeField) {
> > int offset = getOffsetToAdd(instant);
> > instant = iField.roundFloor(instant + offset);
> > return instant - offset;
> > } else {
> > long localInstant = iZone.convertUTCToLocal(instant);
> > localInstant = iField.roundFloor(localInstant);
> > return iZone.convertLocalToUTC(localInstant, false,
> > instant);
> > }
> >
> > But, this does not work well in my case. If its iTimeFIeld, then it will
> > return the UTC millis, but if not, then there is no need to
> > convertLocalToUTC, since its already in UTC millis because of the
> "bigger"
> > rounding. Is that correct?
>
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest