ndesle
23-04-2009 15:45:31
Hi,
I have a problem converting Caelum's JulianDay back into gregorian calendar. Here's the code I use:
For setting the initial time for Caelum:
For extracting the current date/time again (for displaying the time of day on screen)
I set the initial time to be 14:00:00, and the timescale is 0 at first (so time does not advance).
If I try to extract the time again and print it, it shows 12:00:00.
If I start advancing time, the hours stay at 12:00:00 for a while, then suddenly shift to 18:00:00.
The julianDay value I get from Caelum at 14:00:00 is 2455014.0833333335. When I try entering this value in an on-line julianDay to gregorian converter applet, it correctly returns what I was expecting.
Does anyone have any idea what I'm doing wrong?
Regards
Nils Desle
I have a problem converting Caelum's JulianDay back into gregorian calendar. Here's the code I use:
For setting the initial time for Caelum:
int startYear = 2009;
int startMonth = 7;
int startDay = 1;
int startHour = 14;
int startMinutes = 0;
int startSeconds = 0;
m_CaelumSystem->getUniversalClock()->setGregorianDateTime( startYear, startMonth, startDay, startHour, startMinutes, startSeconds );
For extracting the current date/time again (for displaying the time of day on screen)
int year;
int month;
int day;
int hours;
int minutes;
Caelum::LongReal seconds;
julianDay = m_CaelumSystem->getJulianDay();
Caelum::Astronomy::getGregorianDateTimeFromJulianDay( julianDay, year, month, day, hours, minutes, seconds );
char tmps[256];
sprintf_s( tmps, 256, "%.2d:%.2d:%.2d", hours, minutes, (int) floor( seconds ));
OverlayElement* timePanel = OverlayManager::getSingleton().getOverlayElement("Common/Time");
timePanel->setCaption( tmps );
I set the initial time to be 14:00:00, and the timescale is 0 at first (so time does not advance).
If I try to extract the time again and print it, it shows 12:00:00.
If I start advancing time, the hours stay at 12:00:00 for a while, then suddenly shift to 18:00:00.
The julianDay value I get from Caelum at 14:00:00 is 2455014.0833333335. When I try entering this value in an on-line julianDay to gregorian converter applet, it correctly returns what I was expecting.
Does anyone have any idea what I'm doing wrong?
Regards
Nils Desle