<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Release: Sunrise/Sunset Java Library</title>
	<atom:link href="http://blog.luckycatlabs.com/2009/01/27/release-sunrisesunset-java-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.luckycatlabs.com/2009/01/27/release-sunrisesunset-java-library/</link>
	<description>Making code suck less</description>
	<lastBuildDate>Wed, 17 Mar 2010 03:03:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Croques</title>
		<link>http://blog.luckycatlabs.com/2009/01/27/release-sunrisesunset-java-library/#comment-29</link>
		<dc:creator>Croques</dc:creator>
		<pubDate>Wed, 17 Mar 2010 03:03:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.luckycatlabs.com/?p=3#comment-29</guid>
		<description>Further to my last post...&lt;br&gt;&lt;br&gt;This change to getLocalTimeAsString(...) in class  SolarEventCalculator appears to do it:-&lt;br&gt;&lt;br&gt;private String getLocalTimeAsString(BigDecimal localTime) {&lt;br&gt;        String[] timeComponents = localTime.toPlainString().split(&quot;\.&quot;);&lt;br&gt;        int hour = Integer.parseInt(timeComponents[0]);&lt;br&gt;&lt;br&gt;        BigDecimal minutes = new BigDecimal(&quot;0.&quot; + timeComponents[1]);&lt;br&gt;        minutes = minutes.multiply(BigDecimal.valueOf(60)).setScale(0, RoundingMode.HALF_EVEN);&lt;br&gt;        if (minutes.intValue() == 60) {&lt;br&gt;            minutes = BigDecimal.ZERO;&lt;br&gt;            hour += 1;&lt;br&gt;        }&lt;br&gt;&lt;br&gt;        if(hour &lt; 0 &amp;&amp; minutes == BigDecimal.ZERO) hour += 24;&lt;br&gt;        if(hour &lt; 0) {&lt;br&gt;        	hour += 23; &lt;br&gt;        	int myMin = minutes.intValue();&lt;br&gt;        	myMin = 60 - myMin;&lt;br&gt;        	minutes = BigDecimal.valueOf(myMin);&lt;br&gt;        	}&lt;br&gt;        String minuteString = minutes.intValue() &lt; 10 ? &quot;0&quot; + minutes.toPlainString() : minutes.toPlainString();&lt;br&gt;        String hourString = (hour &lt; 10) ? &quot;0&quot; + String.valueOf(hour) : String.valueOf(hour);&lt;br&gt;        return hourString + &quot;:&quot; + minuteString;&lt;br&gt;    }&lt;br&gt;&lt;br&gt;I forgot to mention that currently I am in NZ and we are 13 hours ahead of Zulu time.</description>
		<content:encoded><![CDATA[<p>Further to my last post&#8230;</p>
<p>This change to getLocalTimeAsString(&#8230;) in class  SolarEventCalculator appears to do it:-</p>
<p>private String getLocalTimeAsString(BigDecimal localTime) {<br />        String[] timeComponents = localTime.toPlainString().split(&#8220;\.&#8221;);<br />        int hour = Integer.parseInt(timeComponents[0]);</p>
<p>        BigDecimal minutes = new BigDecimal(&#8220;0.&#8221; + timeComponents[1]);<br />        minutes = minutes.multiply(BigDecimal.valueOf(60)).setScale(0, RoundingMode.HALF_EVEN);<br />        if (minutes.intValue() == 60) {<br />            minutes = BigDecimal.ZERO;<br />            hour += 1;<br />        }</p>
<p>        if(hour &lt; 0 &#038;&#038; minutes == BigDecimal.ZERO) hour += 24;<br />        if(hour &lt; 0) {<br />        	hour += 23; <br />        	int myMin = minutes.intValue();<br />        	myMin = 60 &#8211; myMin;<br />        	minutes = BigDecimal.valueOf(myMin);<br />        	}<br />        String minuteString = minutes.intValue() &lt; 10 ? &#8220;0&#8243; + minutes.toPlainString() : minutes.toPlainString();<br />        String hourString = (hour &lt; 10) ? &#8220;0&#8243; + String.valueOf(hour) : String.valueOf(hour);<br />        return hourString + &#8220;:&#8221; + minuteString;<br />    }</p>
<p>I forgot to mention that currently I am in NZ and we are 13 hours ahead of Zulu time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Croques</title>
		<link>http://blog.luckycatlabs.com/2009/01/27/release-sunrisesunset-java-library/#comment-30</link>
		<dc:creator>Croques</dc:creator>
		<pubDate>Wed, 17 Mar 2010 01:52:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.luckycatlabs.com/?p=3#comment-30</guid>
		<description>Thanks for the spelling correction&lt;br&gt;&lt;br&gt;Current date is good for causing the error mentioned.&lt;br&gt;Just ran a test now and sunrise reported 0-5:31&lt;br&gt;with this code appended to your Test.java :-&lt;br&gt;&lt;br&gt;String sunrise = mySunriseCalc.getOfficalSunriseForDate(t);	&lt;br&gt;System.out.println(&quot;Sunrise is: &quot; + sunrise);&lt;br&gt;System.out.println(&quot;Calendar is: &quot; + t.toString());&lt;br&gt;System.out.println(&quot;Location is: &quot; + myLoc.getLatitude().toPlainString() + &quot;, &quot; + myLoc.getLongitude().toPlainString());&lt;br&gt;&lt;br&gt;produced:-&lt;br&gt;&lt;br&gt;Sunset is: 06:50&lt;br&gt;Sunrise is: 0-5:34&lt;br&gt;Calendar is: java.util.GregorianCalendar[time=1268772592184,areFieldsSet=true,areAllFieldsSet=true,&lt;br&gt;lenient=true,zone=sun.util.calendar.ZoneInfo[id=&quot;GMT&quot;,offset=0,dstSavings=0,useDaylight=false,&lt;br&gt;transitions=0,lastRule=null],firstDayOfWeek=1,&lt;br&gt;minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=2,&lt;br&gt;WEEK_OF_YEAR=12,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,&lt;br&gt;DAY_OF_YEAR=75,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,&lt;br&gt;AM_PM=1,HOUR=8,HOUR_OF_DAY=20,MINUTE=49,SECOND=52,&lt;br&gt;MILLISECOND=184,ZONE_OFFSET=0,DST_OFFSET=0]&lt;br&gt;Location is: -43.47, 172.55&lt;br&gt;&lt;br&gt;Croques</description>
		<content:encoded><![CDATA[<p>Thanks for the spelling correction</p>
<p>Current date is good for causing the error mentioned.<br />Just ran a test now and sunrise reported 0-5:31<br />with this code appended to your Test.java :-</p>
<p>String sunrise = mySunriseCalc.getOfficalSunriseForDate(t);	<br />System.out.println(&#8220;Sunrise is: &#8221; + sunrise);<br />System.out.println(&#8220;Calendar is: &#8221; + t.toString());<br />System.out.println(&#8220;Location is: &#8221; + myLoc.getLatitude().toPlainString() + &#8220;, &#8221; + myLoc.getLongitude().toPlainString());</p>
<p>produced:-</p>
<p>Sunset is: 06:50<br />Sunrise is: 0-5:34<br />Calendar is: java.util.GregorianCalendar[time=1268772592184,areFieldsSet=true,areAllFieldsSet=true,<br />lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,<br />transitions=0,lastRule=null],firstDayOfWeek=1,<br />minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=2,<br />WEEK_OF_YEAR=12,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,<br />DAY_OF_YEAR=75,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,<br />AM_PM=1,HOUR=8,HOUR_OF_DAY=20,MINUTE=49,SECOND=52,<br />MILLISECOND=184,ZONE_OFFSET=0,DST_OFFSET=0]<br />Location is: -43.47, 172.55</p>
<p>Croques</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://blog.luckycatlabs.com/2009/01/27/release-sunrisesunset-java-library/#comment-28</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Tue, 16 Mar 2010 01:06:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.luckycatlabs.com/?p=3#comment-28</guid>
		<description>Thanks for pointing out the spelling error!  It&#039;s fixed and available on github.

As for the error case, can you specify a date that causes the error condition to occur so I can write a test around it?</description>
		<content:encoded><![CDATA[<p>Thanks for pointing out the spelling error!  It&#8217;s fixed and available on github.</p>
<p>As for the error case, can you specify a date that causes the error condition to occur so I can write a test around it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Croques</title>
		<link>http://blog.luckycatlabs.com/2009/01/27/release-sunrisesunset-java-library/#comment-27</link>
		<dc:creator>Croques</dc:creator>
		<pubDate>Mon, 15 Mar 2010 23:40:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.luckycatlabs.com/?p=3#comment-27</guid>
		<description>In SolarEventCalculator, using getOfficalSunriseForDate(Date (GMT)) and its twin getCivilSunriseForDate(Date (GMT)) at location -43.47, 172.55 results in a -ve value for hour which when is string compounded with zero outputs 0-6.03 or 0-5.35. A test for -ve hour and then add 24 could be the way forward?

Also note the inconsistent spelling of Official in getOfficalSunriseForDate.

Croques.</description>
		<content:encoded><![CDATA[<p>In SolarEventCalculator, using getOfficalSunriseForDate(Date (GMT)) and its twin getCivilSunriseForDate(Date (GMT)) at location -43.47, 172.55 results in a -ve value for hour which when is string compounded with zero outputs 0-6.03 or 0-5.35. A test for -ve hour and then add 24 could be the way forward?</p>
<p>Also note the inconsistent spelling of Official in getOfficalSunriseForDate.</p>
<p>Croques.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
