Stephen Colebourne <scolebou...@joda.org> wrote on 05/04/2012 12:42:28 PM:
> Well, getDSTSavings() is the difference between getStandardOffset()
> and getOffset() for any given instant.
>From the TimeZone source:
public int getDSTSavings()
{
return useDaylightTime () ? 3600000 : 0;
}
Not accurate by any means, but it's the amount by which the offset will
change (in most cases). It is not influenced by the current instant. This
is what I came up with for joda to accomplish the same thing.
public static int getDSTSavings(String tz)
{
DateTimeZone dtz = DateTimeZone.forID( tz );
DateTime dt = new DateTime( dtz );
if ( dtz.isStandardOffset( dt.getMillis() ) ) {
int dstoffset = dtz.getOffset( dtz.nextTransition( dt.getMillis
() ) );
return dstoffset - dtz.getStandardOffset( dt.getMillis() );
} else
return dtz.getOffset( dt ) - dtz.getStandardOffset( dt.getMillis()
);
}
> The standard offset can and does changes over time. For example, if
> the UK moved to have its clocks on the same time as France and
> Germany, the standard offset would change from zero to one hour.
That makes sense.
Matthew
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest