 |
|
 |
the program give error for minus location and anyway calculate the tims..... fix it
jerusalem is in minus location (-35)
|
|
|
|
 |
|
 |
Hello:
Tried your demo and really cool stuff, thanks so much for posting this code.
When I try the demo it says for my lat / lon (36.560643 / 77.826284) that the Sunrise is 5:51:14 am and the Sunset is 18:37:00 and according to this website ("http://www.calendar-updates.com/sun.asp?PostalCode=23887[^]") the Sunrise is 6:51 and Sunset is 19:38 - this is for April 6th 2011.
There site does not report Solar Noon.
I have to assume the times are off because I am in the East Coast (EST) and we are currently in Daylight Savings Time (DST) and this is not being taken into account?
Before I dive into the code and try and fix something that has already been fixed I was just wondering if there was a different version around that handled DST (assuming that is the problem).
Again great stuff.
Thanks
BobVal
|
|
|
|
 |
|
 |
I can not get this to run every time i try it says : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory can anyone help with this?
|
|
|
|
 |
|
 |
Errors in code, and basic calculations don't work. This article needs to be fixed or removed.
|
|
|
|
 |
|
 |
Would you elaborate on some of the errors you encountered (or which calculations seem faulty)?
|
|
|
|
 |
|
 |
Please provide c# versoin of the code also.
|
|
|
|
 |
|
|
 |
|
 |
Hi;
I want to get the sunrise/set times and moon rise/set times for a longitude and latitude.
Does anyone know how to get the Noon Rise / set times from this?
thanks
-peter
|
|
|
|
 |
|
 |
It looks like there were several problems with UTC, Daylight savings time, etc.
Did anyone go through an clean up those problems or do they have to be patched one at a time?
Thanks.
|
|
|
|
 |
|
 |
count out with sun times(http://www.fv01.dial.pipex.com/world.htm?suntimes.shtml[^]
guangzhou china N23E113:(2005-12-06)
sunrise 06:54:29
midday 12:17:58
sunset 17:41:20
daylength 10:46:52
count out with your demo
sunrise 2005-12-6 21:59:18
sunset 2005-12-7
solar noon 2005-12-7
could you tell me there are differents between them ? thanks
myemail:anqincmt@tom.com:
nothing is verything.
|
|
|
|
 |
|
 |
The offset for UTC needs to be added in, not subtracted. In the code, find lines 203, 246, & 271. Change "iHour -= iHrToTimeZone;" to "iHour += iHrToTimeZone;"
Very useful utility!!
|
|
|
|
 |
|
 |
this code is just what i need for my final project(i'm a student)
is there any1 who knows how to convert it to vb.net?
thanks so much,
michal
|
|
|
|
 |
|
 |
I tried it but it appears that the sunrise is way off (45min), might it be a conversion from double to int?
|
|
|
|
 |
|
 |
Hello.
I can't understand. There are ranges for Lantitude and Longitude between 0 and 180. And how can I enter following values:
for example, 24.45 S , 18.06 E
or 15.70 N , 5.37 W
Which meridian and equator that example must be calculated from?
I tried enter -24.45 (for South) and -18.06 (for East) but there only INTEGER values are allowed.
Please help me!
Thank you.
|
|
|
|
 |
|
 |
Hi,
in which format I must input the latitude and longitude in the program?
Please, give me an example.
Thanks.
Piccinano
|
|
|
|
 |
|
 |
45°1234m is 45.1234. That simple.
|
|
|
|
 |
|
 |
>45°1234m
Which meridian that coordinate is calculated from?
If I have 45°1234 N or 45°1234 S or 45°1234 W or 45°1234 E
how can I enter these examples?
|
|
|
|
 |
|
 |
This isn't really a bug but, it is something that some of us have to deal with. When I have perfected the code I will post it. the formulas are: AprilDate = (2+6 * thisYear - Math.floor (thisYear / 4) ) % 7 + 1; OctoberDate= (31-( Math.floor (thisYear * 5 / 4) + 1) % 7); This is in JavaScript but it is easily converted. Darroll Walsh
|
|
|
|
 |
|
 |
Here is the code for VC++ // Add an hour if in daylight savinds // AprilDate = (2+6 * thisYear - Math.floor (thisYear / 4) ) % 7 + 1; // OctoberDate= (31-( Math.floor (thisYear * 5 / 4) + 1) % 7); // set this bool in options for areas that aren't in daylight savings. bool m_bDaylightSavings = true; if( m_bDaylightSavings ) { // April date int year = tTime.GetYear(); int temp = floor( year /4 ); int AprilDate = (2 + 6 * year - temp ) % 7 + 1; // October date temp = floor( year * 5 / 4 ); int OctDate = ( 31 - ( temp + 1 ) % 7 ); // BETWEEN APRIL AND OCTOBER WE ARE IN DAYLIGHT SAVINGS if( MyTime.GetMonth() > 4 && MyTime.GetMonth() < 10 ) { MyTime += CTimeSpan( 0,1,0,0); } else { // IF IN APRIL if( MyTime.GetMonth() == 4 ) { if( MyTime.GetDay() >= AprilDate ) { MyTime += CTimeSpan( 0,1,0,0); } } // IF IN OCTOBER if( MyTime.GetMonth() == 10 ) { if( MyTime.GetDay() >= OctDate ) { MyTime += CTimeSpan( 0,1,0,0); } } } } Hope this helps someone; Signature not available do to your secutity settings. Press <CTRL><ALT><DEL> to fix this error.
|
|
|
|
 |
|
 |
This is not helping at all, If you want to know if dst is in effect in VC++ just code:
if ( _daylight )
{
// do DST stuff..
}
|
|
|
|
 |
|
 |
_daylight is not says "is currently daylight savings used or not". it just tells has current time zone DST or not
So it is not changing during the year.
|
|
|
|
 |
|
 |
I found several troubles in your code.
1st - demo project don't agree negative values.
2nd:
Now 2nd of July.
In Moscow: SunRise: 4.51am Sunset: 10.19pm (Lat:56, Lon 38) - it's right.
In Krasnodar: SunRise: 5.53am Sunset: 9.25pm (Lat:45, Lon 39) - it's wrong !!!
|
|
|
|
 |
|
 |
I've experienced the same problem. Even after fixing the basic errors, the fundamental algorithm doesn't correctly calculate sunrise/sunset times.
|
|
|
|
 |
|
 |
The height above see level also should be taken into consideration.
|
|
|
|
 |
|
 |
Hi,
I have since had to use my own code for a Utility Im
writing for my fishing site(Uglybass.com), so I figured
out how to convert quite easily to Local time... Just
add the three lines given below to the bottom of all three function; GetSunrise(..) GetSunset(..) and GetSolarnoon(..) right before the line:
CTime NewTime(time.GetYear(),time.GetMonth(),time.GetDay(),iHour,iMinute,iSecond);
add:
_tzset();
int iHrToTimeZone = _timezone / 3600; //returns a difference value in seconds
iHour -= iHrToTimeZone;
Sorry, for the original sloppy article. I believe I was a
little ticked at the people who didn't want to share this
simple code!!! So I wrote it very quickly!!
Enjoy!!!
Brian
|
|
|
|
 |