CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Posts
    2

    WIN API sunset time information

    Hello,

    I was searching in windows api reference and I haven't found any win api function that retrieves the sunset or sunrise time information, but a friend of mine sweared me that it exists...

    Anyone knows if it exists? If not is it possible to calculate it without location information?

    Thanks,
    Tiago Brunhoso Nunes

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: WIN API sunset time information


  3. #3
    Join Date
    May 2002
    Posts
    1,435

    Re: WIN API sunset time information

    Quote Originally Posted by hoxsiew View Post
    I usually find those "Let me Google that for you" posts to be more funny than helpful, but this is a good one. The very first entry in the Google results contains a very interesting algorithm. Of course it's not C++ but any good programmer should have no trouble at all creating code from it.

    Sunrise/Sunset Algorithm

  4. #4
    Join Date
    May 2002
    Posts
    1,435

    Re: WIN API sunset time information

    Quote Originally Posted by omniausente View Post
    is it possible to calculate it without location information?
    Longitude can be approximated by time-zone information but Latitude, which I would say is more important, can't. You could always use a typical value such as 40 degrees north for U.S. and Europe, etc. but any generalization of longitude and latitude will add to the error of your calculation.

  5. #5
    Join Date
    Feb 2005
    Posts
    2,160

    Re: WIN API sunset time information

    Quote Originally Posted by 0xC0000005 View Post
    I usually find those "Let me Google that for you" posts to be more funny than helpful, but this is a good one. The very first entry in the Google results contains a very interesting algorithm. Of course it's not C++ but any good programmer should have no trouble at all creating code from it.

    Sunrise/Sunset Algorithm
    Yes, I read through that one and found it very interesting.

  6. #6
    Join Date
    Jul 2009
    Posts
    2

    Re: WIN API sunset time information

    Thanks for the answers!

    From your posts I conclude that the windows api itself doesn't have this kind of information...

    And thanks also for the longitude aproximation tip... it can be useful!

    PS: This was not intended to be a "Google it for me" question, as I already made that search by my self. I was only thinking that windows api could have this info for me... I just need to know if it is day or night

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured